akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

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

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

signed main() {
	int a;
	cin >> a;
	int ans = a + a * a + a * a * a;
	cout << ans << endl;
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  char a[100][100], b[102][102];
  
  for (int i = 0; i < h+2; i++) {
    for (int j = 0; j < w+2; j++) {
      b[i][j] = '#';
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
      b[i+1][j+1] = a[i][j];
    }
  }
  for (int i = 0; i < h+2; i++) {
    for (int j = 0; j < w+2; j++) {
      cout << b[i][j];
    }
    cout << endl;
  }
      

}


Measured memory_bytes: 256
n,m = map(int,input().split())
trg = list(map(int,input().split()))
trg.sort()
dist = []
if m ==1:
    print(0)
    exit()
for i in range(1,m):
    dist.append(trg[i] - trg[i-1])
dist.sort()

if n>=m:
    print(0)
    exit()
else:
    print(sum(dist[:m-n]))

Measured memory_bytes: 13968
#!usr/bin/env python3

import sys


def string_to_list_spliter():
    h, w = [int(i) for i in sys.stdin.readline().split()]
    return h, w


def generate_frame(h, w):
    frame = ''
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h-1:
                frame += '#'
            else:
                if j == 0 or j == w-1:
                    frame += '#'
                else:
                    frame += '.'
        frame += '\n'
    return frame


def print_frame():
    while True:
        h, w = string_to_list_spliter()
        if h == 0 and w == 0:
            break
        print(generate_frame(h, w))


def main():
    print_frame()


if __name__ == '__main__':
    main()

Measured memory_bytes: 7768
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;


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

long long X, Y;

int main() {
  COMinit();
  cin >> X >> Y;
  long long n, k;
  if((X+Y)%3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  n = (X+Y) / 3;
  k = (2 * Y - X) / 3;
  long long ans = COM(n, k);
  cout << ans << endl;
  return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  int i;
  int ch = 0;
  for(i = 0; i < s.size(); i++)
  {
    if(i == a && s.at(i) != '-')
    {
      ch = 1;
      break;
    }
    if(i != a &&(s.at(i) < '0' || s.at(i) > '9'))
    {
      ch = 1;
      break;
    }
  }
  if(ch == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	double x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	printf("%.10lf\n", sqrt(abs(x1-x2)*abs(x1-x2) + abs(y1-y2)*abs(y1-y2))); 
}



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

int main(){
  int n;
  string s;
  cin >> n >> s;

  long long r=0,g=0,b=0;
  for (int i = 0; i < n; i++)
  {
    if(s[i]=='R') r++;
    if(s[i]=='G') g++;
    if(s[i]=='B') b++;
  }

  long long ans = r*g*b;
  for (int i = 0; i < n; i++)
  {
    for (int j = i+1; j < n; j++)
    {
      int k = j+j-i;
      if(k>=n) break;
      if(s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i]) ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        String a = s.substring(0,1);
        String b = s.substring(1,2);
        String c = s.substring(2,3);
        
        if((a.equals(b))&&(a.equals(c))){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 24916
#include<stdio.h>
int main()
{
	int N,T,A,i,h,num=0;
	double t,td,min=9999;
	scanf("%d%d%d",&N,&T,&A);
	for(i=0;i<N;i++)
	{scanf("%d",&h);
	t=T-h*0.006;
	td=A-t;
	if(td<0)td=-td;
	if(td<=min){min=td;num=i;
	}
	}
	printf("%d\n",num+1);
		return 0;
 
 } 

Measured memory_bytes: 128
N, M = map(int,input().split())
c = [list(map(int,input().split())) for a in range(N)]

a = []
list_multi = [[-1,-1,-1],[-1,-1,1],[-1,1,-1],[-1,1,1],[1,-1,-1],[1,-1,1],[1,1,-1],[1,1,1]]
for i in list_multi:
    b = []
    for c_list in c:
        b.append(sum([c_list[i_]*i[i_] for i_ in range(3)]))
    b.sort()
    b_inv = b[::-1]
    a.append(sum(b_inv[:M]))
print(max(a))

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main() {
	cin.sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	char s[50][50];
	int num = 0;
	rep(i, H) {
		rep(j, W) {
			cin >> s[i][j];
			if (s[i][j] == '#')num++;
		}
	}
	queue < pair<int, pair<int, int>>>que;
	if (s[0][0] == '.') {
		que.push({ 2,{0,1} });
		que.push({ 2,{1,0} });
	}
	bool flag[50][50] = {};
	flag[0][0] = true;
	while (que.size()) {
		int cnt = que.front().first;
		int i = que.front().second.first, j = que.front().second.second;
		que.pop();
		if (s[i][j] == '#' || flag[i][j] == true)continue;
		flag[i][j] = true;
		if (i == H - 1 && j == W - 1) {
			cout << H*W - num - cnt << endl;
			return 0;
		}
		if (s[i][j] == '.') {
			reps(x, -1, 2) {
				reps(y, -1, 2) {
					if (x != 0 && y != 0 || x == 0 && y == 0)continue;
					if (i + x >= 0 && i + x < H&&j + y >= 0 && j + y < W)que.push({ cnt + 1,{i + x,j + y} });
				}
			}
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int D;
  int N;
  int hh[3] = {1, 100, 10000};
  char line[128];
  
  fgets(line,127,stdin);
  sscanf(line,"%d %d", &D, &N);
  if (N==100) N++;
  printf("%d\n", hh[D]*N);
  
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;

int main() {
	int a;
	cin >> a;
	int b = 0;
	for (int c = 0; c < a; c++) {
		string d;
		cin >> d;
		if (d == "A")b++;
		else b--;
		if (b < 0)break;
	}
	cout << ((b) ? ("NO") : ("YES")) << endl;
}

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

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

    if(x>=400 && x<=599){
        cout << 8 << endl;
        return 0;
    }

    if(x>=600 && x<=799){
        cout << 7 << endl;
        return 0;
    }

    if(x>=800 && x<=999){
        cout << 6 << endl;
        return 0;
    }

    if(x>=1000 && x<=1199){
        cout << 5 << endl;
        return 0;
    }

    if(x>=1200 && x<=1399){
        cout << 4 << endl;
        return 0;
    }

    if(x>=1400 && x<=1599){
        cout << 3 << endl;
        return 0;
    }

    if(x>=1600 && x<=1799){
        cout << 2 << endl;
        return 0;
    }

    if(x>=1800 && x<=1999){
        cout << 1 << endl;
        return 0;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int A, B, C; cin >> A >> B >> C;
	cout << min(C, B / A) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

vector<vector<int> > calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int> > res(n+1, vector<int>(10, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 10; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'0'] = i;
    }
    return res;
}

int main(){
    int N; cin >> N;
    string S,T;
    cin >> S >> T;
    for (int i=0;i<N;i++){
        cout << S[i] << T[i];
    }
    cout << endl;
    return 0;
}


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


int f(int x){
  int sum = 0;
  while(true){
    int a = 10;
    sum += x % a;
    x = x / a;
    a = a * 10;
    if (x == 0){
      return sum;
    }
  }
}


int main(){
  int N;
  cin >> N;
  
  int min = f(1) + f(N-1);
  for (int i = 1; i < N; i++){
    if (f(i) + f(N-i) < min){
      min = f(i) + f(N-i);
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 256
S = input()
Q = int(input())
reverse = 1
head = ""
tail = ""
for i in range(Q):
    a = input().split()
    if a[0] == "1":
        reverse *= -1
    elif a[1] == "1":
        if reverse == 1:
            head += a[2]
        else:
            tail += a[2]
    else:
        if reverse == 1:
            tail += a[2]
        else:
            head += a[2]
# for i in range(Q):
#     a = input().split()
#     if a[0] == "1":
#         reverse *= -1
#     elif a[1] == "1":
#         if reverse == 1:
#             S = a[2] + S
#         else:
#             S = S + a[2]
#     else:
#         if reverse == 1:
#             S = S + a[2]
#         else:
#             S = a[2] + S
S = head[::-1] + S + tail
if reverse == -1:
    S = S[::-1]
print(S)

Measured memory_bytes: 4468
#include <iostream>
 
using namespace std;
 
int main()
{
    int a, b, c, n = 0;
 
    cin >> a >> b >> c;
 
    for (int i = a; i <= b; i++)
    {
        if (c % i == 0) { n++; }
    }
 
    cout << n << endl;
 
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>

int main() {
 int input[10000];
 int n;
 int i, j;
  int check,count = 0;

 scanf("%d", &n);

 for (i = 0; i != n; i++) {
  scanf("%d", &input[i]);
  check = 0;

  for (j = 2; j*j <= input[i]; ++j) {

   
   if (input[i] % j == 0) {
    check = 1;
    break;
   }
  }

  if (input[i] == 1) {
   count++;
  }
  if (check == 0) {
   count++;
  }
 }

 printf("%d\n", count);
 return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);
	ll n;cin>>n;
	vector<ll> v(n+1);
	ll x = 0;
	rep(i,n)cin>>v[i];
	rep(i,n){
		if(i==0)x = v[i];
		else x = v[i]-x;
	}
	ll ans = 0;
	rep(i,v[0]+1){
		if(i*2==x){
			ans = i;
			break;
		}
	}
	cout << ans*2 << " ";
	v[0] -= ans;
	rep(i,n-1){
		cout << v[i]*2 << " ";
		v[i+1] -= v[i];
	}
	cout << endl;
}



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

using namespace std;

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

    int n;
    cin >> n;
    int a[n];

    for (int i=0; i<n; i++)
        cin >> a[i];

    sort(a, a+n);
    for (int i=0; i<n-1; i++) {
        if (a[i]==a[i+1]) {
            cout << "NO\n";
            return 0;
        }
    }

    cout << "YES\n";

    return 0;
}


Measured memory_bytes: 1024
S = gets.chomp
T = gets.chomp

array = []
for i in 0 .. (S.length - T.length)
    tmp = S.clone
    if S[i] == '?' || S[i] == T[0]
        check = true
        if S[i] == '?'
            tmp[i] = T[0]
        end
        for j in 1 .. (T.length - 1)
            if S[i + j] == '?'
                tmp[i + j] = T[j]
            elsif S[i + j] != T[j]
                check = false
                break
            end
        end
        if check
            for j in 0..(S.length - 1)
                if tmp[j] == '?'
                    tmp[j] = 'a'
                end
            end
            array.push(tmp)
        end
    end
end

if array.empty?
    puts("UNRESTORABLE")
else
    puts(array.min)
end

Measured memory_bytes: 1788
#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool is(char ch){
    if(ch==' ')return true;
    if(ch==',')return true;
    if(ch=='.')return true;
    return false;
}

int main(){
    string s;
    while(getline(cin,s)){
        vector<string> sent;
        
        string tmp="";
        rep(i,s.size()){
            if(!is(s[i])){
                tmp+=s[i];
            }
            else{
                if( tmp.size()>=3 && tmp.size()<=6 )sent.pb(tmp);
                tmp="";
            }
        }
        rep(i,sent.size()){
            if(i!=0)cout<<" ";
            cout<<sent[i];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1184
def main():
    N = int(input())
    S = input()
    if (N % 2 == 1):
        print('No')
    else:
        mid = N // 2
        print('Yes' if (S[:mid] == S[mid:]) else 'No')
    return 0
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int MR = 1e5 + 10;

LL pref[MR];

int main()
{
	int N, M, V, P;
	scanf("%d%d%d%d", &N, &M, &V, &P);
	vector<int> A;
	REP(i, N)
	{
		int a;
		scanf("%d", &a);
		A.push_back(a);
	}

	sort(A.begin(), A.end());
	pref[0] = A[0];
	FOR(i, 1, N)
		pref[i] = A[i] + pref[i - 1];

	int res = 0;
	REP(i, N)
		if (N - i <= P)
			res++;
		else
		{
			int left = max(V - i, 0);

			if (left - P <= 0)
			{
				if (A[i] + M >= A[N - P])
					res++;
			}
			else
			{
				int Vleft = left - P;
				// mamy przedzial [i+1,N-P] kandydatow i M*Vleft glosow
				// zobacz, czy to sie da rozlozyc tak, by kazdy na tym przedziale mial max A[i]+M
				int len = N - P - i;
				if (M*(LL)Vleft <= len * (LL)(A[i] + M) - (pref[N - P] - pref[i])
					&& A[i] + M >= A[N - P])
					res++;
			}
		}

	printf("%d\n", res);

	return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  bool can = false;
  for (int i=1; i<=B; i++) {
    if (i*A%B==C) {
      can = true;
      break;
    }
  }
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int h,w;
	while(scanf("%d%d",&h,&w)&&h!=0&&w!=0){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 3108
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String[] s = in.nextStringArray(3);
            String ans = "";
            for (int i = 0; i < 3; i++) {
                ans += s[i].charAt(0);
            }
            out.println(ans.toUpperCase());
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextString();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <string>
using namespace std;
bool isMonth(int n)
{
    return (1 <= n && n <= 12);
}
int main()
{
    string s;
    cin >> s;
    int a = stoi(s.substr(0, 2));
    int b = stoi(s.substr(2));
    if (isMonth(a) && isMonth(b))
        puts("AMBIGUOUS");
    else if (isMonth(a))
        puts("MMYY");
    else if (isMonth(b))
        puts("YYMM");
    else
        puts("NA");
}

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

int main(){
    ll n,m;
    cin >> n >> m;
    
    vector<vector<ll> > A(n,vector<ll>(m));
    vector<ll> b(m);
    vector<ll> ans(n);
    
    rep(i,n){
        rep(j,m) cin >> A[i][j];
    }
    
    rep(i,m) cin >> b[i];
    
    rep(i,n){
        rep(j,m){
            ans[i] += A[i][j] * b[j];
        }
    }
    
    rep(i,n){
        cout << ans[i] << endl;
    }
}




Measured memory_bytes: 3212
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n;
	int ans = 0;
	cin >> n;
	int v;
	pair<Pi, Pi> as = mp(mp(0, 0), mp(0, 0));
	pair<Pi, Pi> bs = mp(mp(0, 0), mp(0, 0));
	pair<map<int, int>, map<int, int>> dis;
	rep(i, n) {
		cin >> v;
		if (i % 2) {
			dis.F[v]++;
		} else {
			dis.S[v]++;
		}
	}
	repi(itr, dis.F) {
		if (itr->S > as.F.S) {
			as.S = as.F;
			as.F = *itr;
		} else if (itr->S > as.S.S) {
			as.S = *itr;
		}
	}
	repi(itr, dis.S) {
		if (itr->S > bs.F.S) {
			bs.S = bs.F;
			bs.F = *itr;
		} else if (itr->S > bs.S.S) {
			bs.S = *itr;
		}
	}
	if (as.F.F != bs.F.F) {
		ans = n - as.F.S - bs.F.S;
	} else {
		ans = n - max(as.F.S + bs.S.S, as.S.S + bs.F.S);
	}

	cout << ans << endl;
}

Measured memory_bytes: 8244
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
int head[N],cnt; //----------------------------------------------------------------------Graph
struct edge
{
    int x,y,dis;
    bool operator < (const edge a)const
    {
        return dis<a.dis;
    }
}e[N<<3];
int n,m,k;long long ans;
int a[N];
int fa[N];
int gf(int k)
{
    return fa[k]==k?k:fa[k]=gf(fa[k]);
}
int main()
{
    int u,v,w;
    scanf("%d%d",&n,&m);
    memset(a,127,sizeof(a));
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d%d",&e[i].x,&e[i].y,&e[i].dis);
        a[e[i].x]=min(e[i].dis+1,a[e[i].x]);
        a[e[i].y]=min(e[i].dis+2,a[e[i].y]);
    }
    cnt=m;
    int s=2000000000;
    for(int i=0;i<2*n;i++)
    {
        s=min(s+2,a[i%n]);
        if(i>=n)
            e[++cnt].x=i%n,e[cnt].y=(i+1)%n,e[cnt].dis=s;
    }
    sort(e+1,e+cnt+1);
    for(int i=0;i<n;i++)
        fa[i]=i;
    for(int i=1;i<=cnt;i++)
    {
        u=e[i].x,v=e[i].y;
        if(gf(u)==gf(v))continue;
        ans+=e[i].dis;
        fa[gf(u)]=gf(v);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define enum(i,x,y) for(register int i=(x);i<=(y);++i)
#define try(i,x,y) for(register int i=(x);i>=(y);--i)
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=500005,MOD=998244353;

int n,k,fac[MAXN];
int qmi(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%MOD)
		if(y&1)ans=1ll*ans*x%MOD;
	return ans;
}

int main()
{
	#ifndef ONLINE_JUDGE
    //freopen("code.in","r",stdin);
    //freopen("code.out","w",stdout);
	#endif
	readint(n);readint(k);
	if(n==1)return 0*printf("%d\n",qmi(2,k-1));
	n-=2;k-=2;
	fac[0]=1;
	enum(i,1,k)fac[i]=1ll*fac[i-1]*i%MOD;
	int ans=0;
	enum(i,0,k-n)
		ans=(ans+1ll*qmi(2,i)*fac[k-i]%MOD*qmi(1ll*fac[n]*fac[k-i-n]%MOD,MOD-2))%MOD;
	printf("%d\n",ans);
    return 0;
}

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

int main(){
  int n,d; cin >> n >> d;
  int a = 2*d + 1;
  if(n%a== 0){
    cout << n/a << endl;
  }
  else{
    cout << n/a + 1 << endl;
  }
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int k, x; cin >> k >> x;
    if(k * 500 >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3564
/* ex 9_2
series2 */
#include <stdio.h>
#include <stdlib.h>

//リストのノード（スタック内の各データ）の定義
typedef struct node {
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem) {
    //追加する分の領域を確保
    node *newnode = (node *)calloc(1, sizeof(node));
    if (newnode == NULL) exit(1);
    newnode->elem = elem;
    newnode->next = *first;
    *first = newnode;
}

//スタックからデータを取り出す
char pop(node **first) {
    char elem;
    node *tmp = *first;
    if (tmp == NULL) {
        elem = '\0';
    } else {
        elem = tmp->elem;
        *first = tmp->next;
        //取り出したノードのメモリを解放
        free(tmp);
    }

    return elem;
}

int main(void) {
    int count = 0;
    //最初のノードの指す先
    node *first = NULL;
    char inp;
    scanf("%c", &inp);
    while (inp != '\n') {  //入力文字が終了するまで読み取る
        char under = pop(&first);  //読み込みをしている一つ前の文字を取り出す
        if (under == '\0') {  //取り出せない時、入力文字を追加する
            push(&first, inp);
        } else if (
            under ==
            inp) {  //取り出せる時で文字が一致する時、取り出した文字を戻し、入力文字も追加
            push(&first, under);
            push(&first, inp);
        } else {  //文字が不一致の時、削除
            count += 2;
        }
        scanf("%c", &inp);
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 4688
s=input()
S=[s[i] for i in range(len(s))]
characters=[0 for i in range(97,123)]
len(characters)
for i in range(len(S)):
  characters[ord(S[i])-97]=characters[ord(S[i])-97]+1
if 0 in characters:
  print(chr(characters.index(0)+97))
else:
  print('None')

Measured memory_bytes: 9656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  cout << (n-1)*n/2 << endl;
  return 0;
    

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;
typedef long long ll;
int main(){
  int r;
  cin >> r;
  cout << r * r << endl;    
}


Measured memory_bytes: 256
using System;
 
class Program
{
    static void Main()
    {
        while (true)
        {
            var data = Console.ReadLine().Split(' ');
            int m = int.Parse(data[0]);
            int f = int.Parse(data[1]);
            int r = int.Parse(data[2]);
            if (m == -1 && f == -1 && r == -1) break;
            char grade;
 
            int t = m + f;
 
            if (m == -1 || f == -1) grade = 'F';
            else if (t >= 80) grade = 'A';
            else if (t >= 65 && t < 80) grade = 'B';
            else if (t >= 50 && t < 65) grade = 'C';
            else if (t >= 30 && t < 50)
            {
                if (r >= 50) grade = 'C';
                else grade = 'D';
            }
            else grade = 'F';
            Console.WriteLine(grade);
        }
    }
}

Measured memory_bytes: 5284
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const int INF = 1E09;
const int MAX_N = 1E+05;

string s;

int X[MAX_N];

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

    cin >> s;

    int ans = s.size();
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] != s[i + 1])
            ans = min(ans, max(i + 1, int(s.size()) - (i + 1)));
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    ll ans=0;
    if((a[1]-a[0])%2 == 1){
        ans ++;
        a[0]++;
        a[2]++;
    }
    ans += (a[1]-a[0])/2 + (a[2]-a[1]);

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


Measured memory_bytes: 256
import java.util.Scanner;

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

        int a =scan.nextInt();
        int b =scan.nextInt();
        int C =scan.nextInt();

        double radC=C*2*Math.PI/360;

        double S=a*b*Math.sin(radC)/2;
        double d=Math.sqrt(a*a+b*b-2*a*b*Math.cos(radC));
        double h=b*Math.sin(radC);
        double L=a+b+d;
        System.out.printf("%f\n",S);
        System.out.printf("%f\n",L);
        System.out.printf("%f\n",h);

    }
}



Measured memory_bytes: 26460
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(){
   std::string S;
   std::cin >> S;
   int s, e;
   for (int i=0; i<S.size(); i++){
      if (S.at(i) == 'A'){
         s = i;
         break;
      }
   }
   for (int i=S.size()-1; i>=0; i--){
      if (S.at(i) == 'Z'){
         e = i;
         break;
      }
   }
   std::cout << e-s+1 << std::endl;
}



Measured memory_bytes: 640
#include<iostream>
#include<string>
#define ll long long
using namespace std;

const int maxn = 1e5+5;
ll dp[maxn][3];
char t[maxn];
int c[maxn];
int main()
{
    int n,k;
    int score[3];
    cin>>n>>k>>score[0]>>score[1]>>score[2];
    cin>>t;
    for(int i=0;i<n;i++)
    {
        if(t[i]=='r') c[i]=2;
        if(t[i]=='s') c[i]=0;
        if(t[i]=='p') c[i]=1;
    }
    ll ans = 0;
    for(int i=0;i<k;i++)
    {
        int j;
        for(j=i;j<n;j+=k)
        {
            for(int l=0;l<3;l++)
            {
                if(j<k)
                {
                    if(l==c[j]) dp[j][l] = score[l];
                    else dp[j][l] = 0;
                }
                else
                {
                    ll maxi = 0;
                    for(int vv=0;vv<3;vv++)
                    {
                        if(vv!=l) maxi=max(maxi,dp[j-k][vv]);
                    }
                    if(l==c[j]) dp[j][l] = maxi+score[l];
                    else dp[j][l] = maxi;
                }
            }
        }
        ans += max(dp[j-k][0],max(dp[j-k][1],dp[j-k][2]));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  int s,w;
  cin >> s >> w;
  
  if(w >= s)
    cout << "unsafe" << endl;
  else 
    cout << "safe" << endl;
}

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

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <utility>
#include <functional>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;
typedef pair<int, int> pii;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<pii> v(M);
    REP(i, 0, M) {
        int a, b;
        cin >> a >> b;
        v[i] = make_pair(a - 1, b - 1);
    }
    sort(begin(v), end(v), greater<pii>());
    int lst = N;
    int ans = 0;
    REP(i, 0, M) {
        if (lst < v[i].second) {
            continue;
        }
        ans++;
        lst = v[i].first;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,m,ac=0,wa=0;
  cin >> n >> m;
  bool a[n+2] = {false};
  int w[n+2] = {0};
  for (int i = 0; i < m; ++i)
  {
    int a1;
    string s;
    cin >> a1 >> s;
    if(a[a1])
      continue;
    if(!a[a1] && s == "AC")
    {
      ac++;
      a[a1] = true;
    }
    if(!a[a1] && s == "WA")
    {
      w[a1]++;
    }

  }
  for (int i = 1; i <= n; ++i)
  {
    if(a[i])
      wa += w[i];
  }
  cout << ac << " " << wa;
  return 0;
}


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

int main()
{
    long long n;
    int k;
    cin >> n >> k;

    int ans = 0;
    while (n > 0)
    {
        n = n / k;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
//ITNOA
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
typedef long long ll;
const ll INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7,MAXL=25;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
void OUT(long double o,int x){
	 cout<<fixed<<setprecision(x)<<o;
	 return;
}
ll a[MAX];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,k,ans=0;
	cin>>n>>k;
	for(int i=k+1;i<=n;i++){
		ll m=n;
		m-=i-1;
		ans+=i-k;
		ans+=(m/i)*(i-k);
		if(k==0)
			ans--;
		m%=i;
		ans+=max(ll(0),((m%i)-k));
		//cerr<<i<<" "<<ans<<'\n';
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8


def solve(*args: str) -> str:
    s = args[0]
    t = args[1]
    return 'Yes' if len(t)-len(s) == 1 and t[:-1] == s else 'No'


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 9044
c = [list(map(int, input().split())) for _ in range(3)]
cross_left = c[0][0] + c[1][1] + c[2][2]
cross_right = c[0][2] + c[1][1] + c[2][0]
total = 0
for i in range(3):
    total += sum(c[i])
if total % 3 == 0 and total // 3 == cross_left and total // 3 == cross_right:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion
class union_find:
    def __init__(self, n):
        self.n = n
        self.rank = [0]*n
        self.parent = [int(j) for j in range(n)]
    
    def union(self,i,j):
        i = self.find(i)
        j = self.find(j)
        if self.rank[i] == self.rank[j]:
            self.parent[i] = j
            self.rank[j] += 1

        elif self.rank[i] > self.rank[j]:
            self.parent[j] = i
        else:
            self.parent[i] = j

    def find(self, i):
        temp = i
        if self.parent[temp] != temp:
            self.parent[temp] = self.find(self.parent[temp])
        return self.parent[temp]
from math import log2, ceil
from collections import deque, Counter as CC, defaultdict as dd
MOD = int(1e9+7)
def main():
# Enter your code here. Read input from STDIN. Print output to STDOUT
    # for t in range(int(input())):
        
        # n = int(input())
        s = input()
        ans = 0
        ct = 0
        for i in range(3):
            if(s[i]=='R'):
                ct+=1
            else:
                ans = max(ct, ans)
                ct = 0
        ans = max(ct, ans)
        print(ans)
        # l  = [(int(j),ct) for ct,j in enumerate(input().split())]











        



if __name__ == "__main__":
    main()

Measured memory_bytes: 67324
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

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

  int a,b, c;
  cin >> a >> b >> c;
  set<int> s({a,b,c});

  cout << s.size() << endl;

  return 0;
}



Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n):
    for j in range(i+1, n):
        if l[i] == l[j]:
            continue
        for k in range(j+1, n):
            if l[j] == l[k]:
                continue
            if l[k] >= (l[i]+l[j]):
                break
            ans += 1

print(ans)


Measured memory_bytes: 9128
#maior que todos os anteriores
k = int(input())
numerosStr = input().split()
numeros=[]
certo = True
contador=1
for q in numerosStr:
    numeros.append(int(q))

for i in range(1,len(numeros)):
    certo = True
    for j in range(i):
        if numeros[i] < numeros[j]:
            certo=False
            break
    if certo:
        contador+=1
print(contador)

Measured memory_bytes: 3064
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

void dfs(void);
void visit(int);

int A[N][N],n;
int d[N],f[N],color[N],time;

int main(){
   int i,j,k,u,v;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      A[i][j] = 0;
    }
  }
  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      v--;
      A[u][v] = 1;
    }
  }
  dfs();
  return 0;
}
  void dfs(){
    int u;
    for(u = 0; u < n; u++) color[u] = WHITE;
    time = 0;
    for(u =0 ; u < n; u++){
      if(color[u] == WHITE) visit(u);
    }
    for( u = 0; u < n; u++){
      printf("%d %d %d\n",u+1,d[u],f[u]);
    }
  }
  void visit(int u){
    int v;
    color[u] = GRAY; 
    d[u] = ++time;
    for(v = 0; v < n; v++){
      if(A[u][v] == 0) continue;
      if(color[v] == WHITE){
	visit(v);
      }
    }
	color[u] = BLACK;
	f[u] = ++time;
  }
     

Measured memory_bytes: 636
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  int H,W;
  cin>>H>>W;
  char A[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>A[i][j];
    }
  }
  int i=0;
  int j=0;
  while(true){
    bool ok=false;
    bool okk=false;
    if(i+1<H){
      if(A[i+1][j]=='#'){
        A[i][j]='.';
        i++;
        ok=true;
      }
    }
    if(!ok){
      if(j+1<W){
        if(A[i][j+1]=='#'){
          A[i][j]='.';
          j++;
          okk=true;

        }
      }
    }
    if(!ok&&!okk){
      A[i][j]='.';
      break;
    }

  }
  bool hantei=false;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(A[i][j]=='#'){
        hantei=true;
        break;
      }
    }
  }
  if(hantei){
    cout<<"Impossible"<<endl;
  }else{
    cout<<"Possible"<<endl;
  }


}




Measured memory_bytes: 256