akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define i64 unsigned long long
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll mod = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}


int pow(ll x, ll y, ll mod){
    ll ret=1;
    for(;y;y>>=1,x=1ll*x*x%mod){
        if(y&1) ret=1ll*ret*x%mod;
    }
    return ret;
}
void kill()
{
    cout << -1 << endl;
    exit(0);
}

int main() {
    sonic();
    int n;
    i64 next, prev, total, i, t;
    R n;
    i64 ans = 0;
    priority_queue<pair<i64, i64>> q;
    vi A(n), B(n);
    rep(i, n)R A[i];
    rep(i, n){
        R B[i];
        q.push(make_pair(B[i], i));
    }
    while(0<q.size()) {
        i = q.top().second;
        q.pop();
        if(B[i]==A[i])continue;
        if(B[i]<A[i])kill();
        next = (i + 1 + n) % n;
        prev = (n + i - 1) % n;
        total = B[next] + B[prev];
        t = (B[i] - A[i]) / total;
        if(t==0)kill();
        ans += t;
        B[i] -= t * total;
        q.push(make_pair(B[i], i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 8968
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

map<ll,ll>cnt;


void solve()
{
       ll n; cin>>n;
       ll a[n];
       rep(i,0,n) cin>>a[i];
       ll sum=0, ans=0;
       rep(i,0,n)
       {
              sum+=a[i];
              if(sum==0) { ans+=cnt[0]+1; cnt[0]++; }
              else { ans+=cnt[sum]; cnt[sum]++; }
       }
       cout<<ans;
}


int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> A(N+1);
  
  for(int i=0;i<K;i++){
    int d;
    cin >> d;
    for(int j=0;j<d;j++){
      int x;
      cin >> x;
      A.at(x)++;
    }
  }
  
  int cnt=0;
  for(int i=1;i<N+1;i++){
    if(A.at(i) == 0){
      cnt++;
    }
  }
  
  cout << cnt << endl;
  
  return(0); 
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
  int i,j;
  for(i=0;i<9;i++)
  {
    for(j=0;j<9;j++)
    {
      printf("%dx%d=%d\n",i+1,j+1,(i+1)*(j+1));
    }
  }
}


Measured memory_bytes: 2716
n,x=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
if x==sum(l):
  print(n)
elif x>sum(l):
  print(n-1)
else:
  ans=0
  k=0
  for a in l:
    k+=a
    if k>x:
      break
    ans+=1
  print(ans)
  

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <map>
#include <queue>

using namespace std;


int main() {
	ios::sync_with_stdio(false);

	string s;
	int n,q;

	cin >> n >> q;

	queue<pair<string, int>> processes;
	queue<pair<string, int>> answers;
	string name;
	int time;

	for (int i = 0; i < n; i++) {
		cin >> name >> time;
		processes.push(make_pair(name, time));
	}

	pair<string, int> process;
	int period = 0;

	while (!processes.empty()) {
		process = processes.front();
		processes.pop();

		//completed
		if (process.second <= q) {
			period += process.second;
			answers.push(make_pair(process.first, period));
		}
		else {//interrupted 
			period += q;
			process.second -= q;
			processes.push(process);
		}
	}

	while (!answers.empty()) {
		process = answers.front();
		answers.pop();

		cout << process.first << " " << process.second << endl;
	}

	return 0;
}

Measured memory_bytes: 6208
Sa = input()
Sb = input()
Sc = input()
t = 'a'
while True:
    if t == 'a':
        if Sa == '':
            print('A')
            break
        t = Sa[:1]
        Sa = Sa[1:]
    elif t == 'b':
        if Sb == '':
            print('B')
            break
        t = Sb[:1]
        Sb = Sb[1:]
    elif t == 'c':
        if Sc == '':
            print('C')
            break
        t = Sc[:1]
        Sc = Sc[1:]


Measured memory_bytes: 3060
from collections import Counter
N = int(input())
A = []
for _ in range(N):
  A.append(input())

c = Counter(A)
maxcnt = c.most_common()[0][1]
l = []
for i in c.most_common():
  if i[1] != maxcnt:
    break
  l.append(i[0])

for s in sorted(l):
  print(s)

Measured memory_bytes: 122064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**9

n = int(input())
a = [[int(input()),_] for _ in range(n)]
a.sort()
r = 0
for i in range(0,n,2):
    if a[i][1] % 2 == 1:
        r += 1
print(r)


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;

int main(){
    string s, t;    cin >> s >> t;
    int n=s.size();
    vector<set<char>> key(26);

    for(int i=0; i<n; i++)
        key[t[i]-'a'].insert(s[i]);

    string ans="Yes";

    for(int i=0; i<26; i++)
        if(1<key[i].size()) ans = "No";
        
    key = vector<set<char>> (26);

    for(int i=0; i<n; i++)
        key[s[i]-'a'].insert(t[i]);
    for(int i=0; i<26; i++)
        if(1<key[i].size()) ans = "No";
    
    cout << ans << endl;

}

Measured memory_bytes: 776
#include <stdio.h>
#define MAX 100000
typedef long long llong;

int n , k;
llong T[MAX];

int check(llong P)
{
	int i = 0;
	for( int j = 0; j < k; j++)
	{
		llong s = 0;
		while( s + T[i] <= P)
		{
			s += T[i];
			i++;
			if( i == n ) return n;
		}
	}
	return i;
}

int solve()
{
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left > 1)
	{
		mid = (right + left) / 2;
		int v = check(mid);
		if(v >= n) right = mid;
		else left = mid;
	}
	return right;
}

int main(void)
{
	scanf("%d",&n);
	scanf("%d",&k);
	for( int i = 0; i < n; i++)
	{
		scanf("%d",&T[i]);
	}
	llong ans = solve();
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2620
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a;cin>>a;
    cout<<(a/10==9 || a%10==9 ? "Yes" : "No")<<ednl;
}


Measured memory_bytes: 256
s = gets.chomp

bc = ""
bbc = ""
s.each_char.with_index do |c, i|
  if bc == c
    puts "#{i} #{i+1}"
    return
  elsif bbc == c
    puts "#{i-1} #{i+1}"
    return
  end
  bbc = bc
  bc = c
end

puts "-1 -1"

Measured memory_bytes: 14420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

ll n;
ll x[101010],y[101010];
char d[101010];

ll val(ll t){
  ll xM=-10000000000,xm=10000000000,yM=-10000000000,ym=10000000000;
  for(ll i=0;i<n;i++){
    ll a=x[i],b=y[i];
    if(d[i]=='R') a+=t;
    if(d[i]=='L') a-=t;
    if(d[i]=='U') b+=t;
    if(d[i]=='D') b-=t;
    xM=max(xM,a);
    xm=min(xm,a);
    yM=max(yM,b);
    ym=min(ym,b);
  }
  return (xM-xm)*(yM-ym);
}

int main(){
  ll i,j;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>x[i]>>y[i]>>d[i];
    x[i]*=2;
    y[i]*=2;
  }
  vector<ll> ts;

  ll xMR=-1e10,xML=-1e10,xMN=-1e10;
  for(i=0;i<n;i++){
    if(d[i]=='R')  xMR=max(xMR,x[i]);
    else if(d[i]=='L')  xML=max(xML,x[i]);
    else xMN=max(xMN,x[i]);
  }
  ts.pb(xMN-xMR);
  ts.pb(xML-xMN);
  ts.pb((xML-xMR)/2);

  ll xmR=1e10,xmL=1e10,xmN=1e10;
  for(i=0;i<n;i++){
    if(d[i]=='R')  xmR=min(xmR,x[i]);
    else if(d[i]=='L')  xmL=min(xmL,x[i]);
    else xmN=min(xmN,x[i]);
  }
  ts.pb(xmN-xmR);
  ts.pb(xmL-xmN);
  ts.pb((xmL-xmR)/2);

  ll yMR=-1e10,yML=-1e10,yMN=-1e10;
  for(i=0;i<n;i++){
    if(d[i]=='U')  yMR=max(yMR,y[i]);
    else if(d[i]=='D')  yML=max(yML,y[i]);
    else  yMN=max(yMN,y[i]);
  }
  ts.pb(yMN-yMR);
  ts.pb(yML-yMN);
  ts.pb((yML-yMR)/2);

  ll ymR=1e10,ymL=1e10,ymN=1e10;
  for(i=0;i<n;i++){
    if(d[i]=='U')  ymR=min(ymR,y[i]);
    else if(d[i]=='D')  ymL=min(ymL,y[i]);
    else ymN=min(ymN,y[i]);
  }

  ts.pb(ymN-ymR);
  ts.pb(ymL-ymN);
  ts.pb((ymL-ymR)/2);

  ts.pb(0);
  ts.pb(1000000000);

  ll ans=1e18;
  for(i=0;i<ts.size();i++){
    if(ts[i]>=0&&ts[i]<1e9) {
      ll p=val(ts[i]);
      ans=min(ans,p);
      }
  }
  printf("%.15lf\n",ans/(double)4);
  return 0;
}

Measured memory_bytes: 1920
int main() {
	char a[100];
	scanf("%s", a);
	int n = strlen(a);
	
	for (int i = 0; i < (n / 2); i++) {
		if (a[i] != a[n - (i+1)]) {
			printf("No");
			return 0;
		}
	}
	for (int i = 0; i < ((n-1) / 4); i++) {
		if (a[i] != a[((n-1)/2)-(i+1)]) {
			printf("No");
			return 0;
		}
	}
	for (int i = 0; i < ((n-1) / 4); i++) {
		if (a[((n+3)/2)-(1-i)] != a[n - (i+1)]) {
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6+5;
int a[MAXN]= {0};
map<int,int>mm;
int solve(int n) {
    /*
    if(mm[n]>1||mm[1])
        return 0;
    for(int i=2;i*i<=n;++i){
        if(n%i==0){
            mm[n]--;
            if(mm[n/i]||mm[i]){
                mm[n]++;
                return 0;
            }
            mm[n]++;
        }
    }
    return 1;
    */

    int f;
    for(int j=1; j*j<=n; j++) {
        if(n%j==0) {
            f=0;
            mm[n]--;
            if(mm[j]||mm[n/j]) {
                f=1;
            }
            mm[n]++;
            if(f)
                return 0;
        }
    }
    return 1;

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        mm[a[i]]++;
    }
    int ans = 0;
    for(int i=0; i<n; i++) {
        ans+=solve(a[i]);
    }
    cout <<ans << endl;
    return 0;
}


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

int main() {
  int N, M = 0;
  cin >> N;
  if(N == 1){
    cout << '1' <<endl;
  }
  else{
  for(int i = 0;i < N; i++){
    for(int j = 2; j < N; j++){
  if(pow(i,j) <= N && pow(i,j) > M){
    M = pow(i,j);
  }
  }
}
cout << M <<endl;
}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int i, j, k, h, w;
   
    cin >> h >> w;
    while(h>0 || w>0)
    {
        for(i=1; i<=h; i++)
        {
            for(j=1; j<=w; j++)
            {
                if(i!=1&&j!=1&&i!=h&&j!=w)
                cout<<".";
                else
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
    }
}


Measured memory_bytes: 3092
N = str(input())

# 桁数が奇数の値の個数
length = len(N)

# MAX6桁1000000
if length == 6:
    # 5桁、3桁、1桁全て
    # 10000-99999
    # 100-999
    # 1-9
    print(90000 + 900 + 9)
elif length == 5:
    # 3桁、1桁全てと4桁
    print(900 + 9 + (int(N) - 10000 + 1))
elif length == 4:
    # 3桁と1桁
    print(900 + 9)
elif length == 3:
    # 1桁と3桁
    print((9 + (int(N)) - 100 + 1))
elif length == 2:
    print(9)
else:
    print(N)

Measured memory_bytes: 3060
#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 ai,ao,at,aj,al,as,az;
  cin >>ai >> ao >> at >> aj >> al >> as >> az;
  ll ans=0;
  ll san;
  if(ai>0&&aj>0&&al>0){
    san=1LL;
    ans +=san*3LL;
    ans +=(ai-san)/2LL * 2LL;
    ans +=(aj-san)/2LL * 2LL;
    ans +=(al-san)/2LL * 2LL;
    ans +=ao;
  }
  ll ans2=0;
  san=0;
  ans2 +=san;
  ans2 +=(ai-san)/2LL * 2LL;
  ans2 +=(aj-san)/2LL * 2LL;
  ans2 +=(al-san)/2LL * 2LL;
  ans2 +=ao;
  cout <<  max(ans,ans2) << endl;
    
  
  


  
  return 0;
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int H,W; cin>>H>>W;
  vi A={0,2,3,4,5,6,7,8,9},B(10);
  vii C(10,vi(10));
  rep(i,0,10){
    rep(j,0,10) cin>>C[i][j];
  }
  rep(i,0,H){
    rep(j,0,W){
      int X; cin>>X;
      if(X!=-1)
      B[X]++;
    }
  }
  vi K(10,MOD);
  do{
    int S=0,sum=0,i=0,memo,Q=-1;
    vi Y(10);
    for(int X:A){
      if(i>0)
        S+=C[memo][X];
      i++;
      Y[X]=S;
      memo=X;
    }
    S+=C[memo][1];
    rep(i,0,10){
      K[i]=min(K[i],S-Y[i]);
    }
  }while(next_permutation(ALL(A)));
  int ans=0;
  ans+=K[0]*B[0];
  rep(i,2,10)
    ans+=K[i]*B[i];
  cout<<ans<<endl;
  }



Measured memory_bytes: 764
T1, T2=map(int,input().split())
A1, A2=map(int,input().split())
B1, B2=map(int,input().split())

if A1 - B1 > 0:
  A1, B1 = B1, A1
  A2, B2 = B2, A2
  
d = (A1 - B1) * T1 + (A2 - B2) * T2

if d > 0:
  if ((B1 - A1) * T1) % d == 0:
    print(((B1 - A1) * T1 // d) *  2)
  else:
    print(((B1 - A1) * T1 // d) *  2 + 1)
elif d < 0:
  print(0)
else:
  print("infinity")

Measured memory_bytes: 3064
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef map<int, int> INTMAP;
int search(vector<int> vec, int n) {
	for (int i=0; i<vec.size(); i++) {
		if (vec[i] == n) return i+1;
	}
	return 0;
}
int main() {
	INTMAP nums;
	vector<int> pts;
	int num, pt;
	while (scanf("%d%*c%d", &num, &pt)) {
		if (num == 0 && pt == 0) break;
		nums.insert(INTMAP::value_type(num, pt));
		if (search(pts,pt) == 0) pts.push_back(pt);
	}
	sort(pts.begin(), pts.end());
	reverse(pts.begin(), pts.end());
	while (scanf("%d", &num) != EOF) {
		printf("%d\n", search(pts, nums[num]));
	}
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
using namespace std;
struct point{
    int a, b;
    bool operator<(const point &p)const{
        return a+b<p.a+p.b;
    }
}w[5010];
int D[5010][5010], INF = 1020000000, res;
void UDT(int &a, int b){
    if(b==-1)return;
    b = min(b, INF);
    if(a==-1)a = b;
    else a = min(a,b);
}
int main(){
    int i, j, n;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d%d",&w[i].a,&w[i].b);
    }
    sort(w+1,w+n+1);
    for(i=0;i<=n;i++)for(j=0;j<=n;j++)D[i][j]=-1;
    D[0][0]=0;
    for(i=1;i<=n;i++){
        for(j=1;j<=i;j++){
            if(D[i-1][j-1]!=-1 && D[i-1][j-1] <= w[i].a){
                int t = D[i-1][j-1] + w[i].b;
                UDT(D[i][j],t);
            }
            UDT(D[i][j],D[i-1][j]);
            if(i==n && D[i][j]!=-1)res = j;
        }
    }
    printf("%d\n",res);
}

Measured memory_bytes: 98048
/*
Author : Vidish Joshi
*/

#include <bits/stdc++.h>
using namespace std;

//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

#define ll long long int
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
#define FOR1(i, m, n) for(i=m; i<n; i++)
#define FOR2(i, n, m) for(i=n-1; i>=m; i--)
#define re(v) ll v; cin>>v
#define mod 1000000007
#define mod2 998244353
#define mp make_pair
#define pb push_back
#define fill(a) memset(a, 0, sizeof(a))
#define start ll t; cin>>t; while(t--)
#define start1 ll t = 1; while(t--)
#define F first
#define S second
#define br "\n"

void solve(){
    string s; cin>>s;

    int cnt = 0, mx = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='R') cnt++;
        else mx = max(mx, cnt), cnt = 0;
    }
    mx = max(mx, cnt);

    cout<<mx<<br;
}

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


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
    int A,B;
    cin>>A>>B;
    if(A==B)
        {
            cout<<"Draw"<<endl;
        }
    else if(A==1&&B!=1)
        {
            cout<<"Alice"<<endl;
        }
    else if(A!=1&&B==1)
        {
            cout<<"Bob"<<endl;
        }

    else if(A>B){
        cout<<"Alice"<<endl;
    }
    else
    {
        cout<<"Bob"<<endl;
    }
        return 0;
}


Measured memory_bytes: 256
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(int)
}

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

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

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
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n, k := r.nextInt(), r.nextInt()

	ans := 0
	for {
		if n <= 0 {
			break
		}
		ans++
		n /= k

	}

	fmt.Fprintln(stdout, ans)
}


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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

int in() { int x; scanf("%d", &x); return x; }
template<typename T> void pv(T a, T b) { for (T i = a; i < b; i++) cout << *i << ' '; cout << endl; }
template<typename T, typename U> void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> void chmax(T &x, U y) { if (x < y) x = y; }

int N;
int p[100010];

int main() {
  N = in();
  REP(i,N) p[i] = in() - 1;

  int res = 0;
  REP(i,N) if (i == p[i]) {
    res++;
    i++;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 640
# -*- coding: utf-8 -*-
n = int(input())
s = input()
t = input()
txt = s+t
tmp = ''

for i in range(1,n):
    tmp = s+t[i:]
    if tmp[-n:]==t:
        txt = tmp

if s==t:
    print(len(s))
else :
    print(len(txt))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

//ここから

void solve(){
  int n;
  cin>>n;
  vector<int>v(n),c(n);
  rep(i,n)cin>>v[i];
  rep(i,n)cin>>c[i];
  int sum=0;
  rep(i,n){
    if(v[i]-c[i]>0)sum+=v[i]-c[i];
  }
  cout<<sum;
}

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


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

int main(){
	int A,B;
	cin >> A >> B;
	char ans[100][100];
	for(int i=0;i<100;i++)for(int j=0;j<100;j++){
		if(i<50)ans[i][j]='#';
		else ans[i][j]='.';
	}
	
	int a=1,b=1;
	for(int i=0;i<50;i+=2)for(int j=0;j<100;j+=2){
		if(a==A)break;
		ans[i][j]='.';
		a++;
	}
	for(int i=0;i<50;i+=2)for(int j=0;j<100;j+=2){
		if(b==B)break;
		ans[99-i][99-j]='#';
		b++;
	}
	
	cout << "100 100" << endl;
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			cout << ans[i][j];
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(void){
    int n,lim; cin>>n>>lim;
    vector <vector<int>> dp(n+1 ,vector <int>(12000 ));
    vector <int> v(n);
    vector <int> w(n);
    rep(i,n) cin>>v[i]>>w[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<= lim;j++){
            if( j < w[i]){
                dp[i+1][j] = dp[i][j];
            }else{
                chmax(dp[i+1][j], dp[i][j]);
                chmax(dp[i+1][j], dp[i+1][j-w[i]] + v[i]);
            }
        }
    }
    cout<<dp[n][lim]<<endl;
}



Measured memory_bytes: 7592
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[100000];
signed main(){
	int n,ans=0,mi=INF,ma=-INF;
	cin>>n;
	f(i,n){
		cin>>x[i];
		ans+=abs(x[i]);
		if(x[i]<0) ma=max(ma,x[i]);
		if(abs(ma)>x[i]&&x[i]>=0) mi=min(mi,x[i]);
	}
	sort(x,x+n);
	int i=lower_bound(x,x+n,0)-x-1;
	if(i%2==0) ans-=min(mi,abs(ma))*2;
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
const int N= 1e5 + 10;
inline void fastio()
{ 
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}


int main()
{
    int S, W;
    cin >> S >> W;
    if (S > W)
        cout << "safe";
    else
        cout << "unsafe";
    return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long int n;
  cin >> n;
  vector<long long int> d;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      d.push_back(i);
      if (i * i < n) d.push_back(n / i);
    }
  }
  d.push_back(n);
  long long int ans = 0;
  for (auto it : d) {
    if (n / it < it - 1) {
      ans += it - 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int m = sc.nextInt();
			int n = sc.nextInt();
			int k = sc.nextInt();
			int[][] mapJ = new int[m+2][n+2];
			int[][] mapO = new int[m+2][n+2];
			int[][] mapI = new int[m+2][n+2];
			
			String t = "";
			int pj, po, pi;
			for(int i=1;i<=m;i++){
				t = sc.next();
				for(int j=1;j<=n;j++){
					pj = 0;
					po = 0;
					pi = 0;
					if(t.codePointAt(j-1)==74){
						pj = 1;
					}else if(t.codePointAt(j-1)==79){
						po = 1;
					}else{
						pi = 1;
					}	
					mapJ[i][j] = pj + mapJ[i][j-1] + mapJ[i-1][j] - mapJ[i-1][j-1];
					mapO[i][j] = po + mapO[i][j-1] + mapO[i-1][j] - mapO[i-1][j-1];
					mapI[i][j] = pi + mapI[i][j-1] + mapI[i-1][j] - mapI[i-1][j-1];
				}
			}
			
			int a, b, c, d, cj, co, ci;
			
			for(int i=0;i<k;i++){
				a = sc.nextInt();
				b = sc.nextInt();
				c = sc.nextInt();
				d = sc.nextInt();

				cj = mapJ[c][d] - mapJ[c][b-1] - mapJ[a-1][d] + mapJ[a-1][b-1];
				co = mapO[c][d] - mapO[c][b-1] - mapO[a-1][d] + mapO[a-1][b-1];
				ci = mapI[c][d] - mapI[c][b-1] - mapI[a-1][d] + mapI[a-1][b-1];
				
				System.out.println(cj + " " + co + " " + ci);
			}
		}
	
	}	
}

Measured memory_bytes: 175880
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = [((i-1)//n, (i-1) % n) for i in a]
    b = [[min(i, n-i-1, j, n-j-1) for j in range(n)] for i in range(n)]
    sit = [[True for j in range(n)] for i in range(n)]
    ans = 0
    for i, j in a:
        sit[i][j] = False
        ans += b[i][j]
        q = [(i, j, b[i][j])]
        while q:
            x, y, z = q.pop()
            if x != 0:
                if b[x-1][y] > z:
                    b[x-1][y] = z
                    q.append((x-1, y, z+sit[x-1][y]))
            if x != n-1:
                if b[x+1][y] > z:
                    b[x+1][y] = z
                    q.append((x+1, y, z+sit[x+1][y]))
            if y != 0:
                if b[x][y-1] > z:
                    b[x][y-1] = z
                    q.append((x, y-1, z+sit[x][y-1]))
            if y != n-1:
                if b[x][y+1] > z:
                    b[x][y+1] = z
                    q.append((x, y+1, z+sit[x][y+1]))
    print(ans)


main()


Measured memory_bytes: 250248
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int x = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        System.out.println(Math.abs(x - a) < Math.abs(x - b) ? "A" : "B");
    }
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Integer>{
    @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
    public void add(T key,int v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
vector<int> a[4];
int cum[4][111];

int main(){

    // 1. 入力情報.
    int N;
    LL W;
    scanf("%d %lld", &N, &W);
    
    // 2. 重さで分類.
    int v;
    LL w1, w;
    rep(i, N){
        scanf("%lld %d", &w, &v);
        if(!i) w1 = w;
        a[w - w1].pb(v);
    }
    
    // 3. sort.
    rep(i, 4){
        sort(all(a[i]));
        reverse(all(a[i]));
    }
    
    // 4. 累積和.
    rep(i, 4) rep(j, a[i].size()) cum[i][j + 1] = cum[i][j] + a[i][j];
    
    // 5. バッグに入れた物の価値の総和の最大値は？
    int ans = 0;
    rep(p, a[0].size() + 1){
        rep(q, a[1].size() + 1){
            rep(r, a[2].size() + 1){
                rep(s, a[3].size() + 1){
                    if(w1 * p + (w1 + 1) * q + (w1 + 2) * r + (w1 + 3) * s <= W){
                        ans = max(ans, cum[0][p] + cum[1][q] + cum[2][r] + cum[3][s]);
                    }
                }
            }
        }
    }
    
    // 6. 出力.
    printf("%d\n", ans);
    return 0;

}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Numerics;

namespace abc138
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc138C();
        }

        public static void solve_abc138C()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] v = Console.ReadLine().Split(' ');
            int[] vals = Array.ConvertAll(v, int.Parse);
            Array.Sort(vals);
            
            decimal prev = vals[0];
            for (int i = 1; i < n; i++)
            {
                decimal cur = Convert.ToDecimal(vals[i]);
                prev = (prev + cur) / 2;
            }


            Console.WriteLine(Math.Round(prev, 14));
        }

        public static void solve_abc138B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] a = Console.ReadLine().Split(' ');

            decimal sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum += 1 / Convert.ToDecimal(a[i]);
            }

            sum = 1 / sum;

            Console.WriteLine(Math.Round(sum, 14));
        }

        public static void solve_abc138A()
        {
            int a = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();

            Console.WriteLine(a >= 3200 ? s : "red");
        }
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b; cin>>a>>b;
    string s; cin>>s;
    bool ok = true;
    rep(i,s.size()){
        if (i<a && !('0'<=s[i] && s[i]<='9')) ok = false;
        if (i==a && s[i]!='-') ok = false;
        if (i>a && !('0'<=s[i] && s[i]<='9')) ok = false;
    }
    if (ok)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


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

int main(){
	
	int S,h,m,s;
	
	cin >> S;
	
	h = S / 3600;
	
	m = (S % 3600) / 60;
	
	s = S - (3600*h) - (60*m);
	
	cout << h << ":" << m << ":" << s << endl;
	
	return 0;
}

Measured memory_bytes: 3080
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a, b;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> a >> b;
    cout << (a + b - 1) / b << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;

int main(void){
  
  I(N);
  FOR(i, 1, N+1) {
    ll t;
    I(t);
    if (i % 2 == 1 && t % 2 == 1) {
      ret++;
    } 
  }

  P(ret);

}


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

struct day
{
	int a,b,c;	
};

int max_points(day m[], int n)
{
	day dp[n];
	dp[0].a = m[0].a;
	dp[0].b = m[0].b;
	dp[0].c = m[0].c;
	for(int i=1;i<n;i++){
		dp[i].a = max(dp[i-1].b,dp[i-1].c)+m[i].a;
		dp[i].b = max(dp[i-1].a,dp[i-1].c)+m[i].b;
		dp[i].c = max(dp[i-1].a,dp[i-1].b)+m[i].c;
	}
	return max(dp[n-1].a,max(dp[n-1].b,dp[n-1].c));
}
int main()
{
	int n,i=0;cin>>n;
	day m[n];
	int a,b,c;
	while(i<n)
	{
		cin>>m[i].a>>m[i].b>>m[i].c;
		i++;
	}
	cout<<max_points(m,n)<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

void fail(){
	cout << -1 << endl;
	exit(0);
}

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

	int n;
	cin >> n;

	vi a(n);
	vi b(n);
	trav(x, a) cin >> x;
	trav(x, b) cin >> x;
	rep(i,0,n) if(b[i] < a[i]) fail();

	auto todo = [&](int i){
		int j = i ? i-1 : n-1;
		int k = i==n-1 ? 0 : i+1;
		return b[i] > a[i] && b[i] > max(b[j], b[k]);
	};
	ll ans = 0;
	stack<int> st;
	auto dodo = [&](int i){
		int j = i ? i-1 : n-1;
		int k = i==n-1 ? 0 : i+1;
		int s = b[j] + b[k];
		int l = (b[i]-a[i]) / s;
		if(l == 0) fail();
		ans += l;
		b[i] -= l * s;
		if(todo(j)) st.push(j);
		if(todo(k)) st.push(k);
	};
	rep(i,0,n) if(todo(i)) st.push(i);
	while(!st.empty()){
		int i = st.top(); st.pop();
		dodo(i);
	}
	if(a == b) cout << ans << endl;
	else fail();
}


Measured memory_bytes: 2304
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n;
	cin >> n;
	map<int, int> mp;
	REP(i, n)
	{
		i64 a;
		cin >> a;
		if (a % 4 == 0)
			mp[4]++;
		else if (a % 2 == 0)
			mp[2]++;
		else
			mp[1]++;
	}

	if (mp[2] % 2 == 1)
		mp[1]++;

	if (mp[4] >= mp[1] || mp[4] + 1 == mp[1])
		print("Yes");
	else
		print("No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

int main(){
    string s; cin >> s;
    vector<string> str(5);
    str[0] = "dream"; str[2] = "dreamer";
    str[1] = "erase"; str[3] = "eraser";
    for(int i = 0; i < 4; i++) reverse(str[i].begin(), str[i].end());
    reverse(s.begin(), s.end());
    string w;
    int len = s.length();

    while(1){
        len = s.length();
        if(len < 5) break;
        if(s[0] == 'm' && len >= 5){
            w = s.substr(0,5);
            if(w == str.at(0)){
                s = s.substr(5,len-5);
                continue;
            }
        }else if(s[0] == 'e' && len >= 5){
            w = s.substr(0,5);
            if(w == str.at(1)){
                s = s.substr(5,len-5);
                continue;
            }
        }else if(s[0] == 'r'){
            if(s[2] == 'm' && len >= 7){
                w = s.substr(0,7);
                if(w == str.at(2)){
                    s = s.substr(7,len-7);
                    continue;
                }
            }
            if(s[2] == 's' && len >= 6){
                w = s.substr(0,6);
                if(w == str.at(3)){
                    s = s.substr(6,len-6);
                    continue;
                }
            }
        }

        cout << "NO" << endl;
        return 0;
    }
    if(len == 0)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 576
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>
#include <limits>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back
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; }

//ユークリッドの互除法
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }


int main()
{	
	int n, k;
	cin >> n >> k;
	vector<int> d(n);
	rep(i, k) {
		int m;
		cin >> m;
		rep(j, m) {
			int a;
			cin >> a;
			d[a - 1] = 1;
		}
	}
	int ans = 0;
	rep(i, n) {
		if (d[i] == 0) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3628
fun main(args: Array<String>) {
    a46(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}


fun a46(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val colorSet = args[0].split(" ").map { it.toInt() }.toSet()
    print(colorSet.size)
}

Measured memory_bytes: 37952
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        sc.close();

        // 主処理
        StringBuilder sb = new StringBuilder(n);
        sb.reverse();
        boolean judge = n.equals(sb.toString());
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21588
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, ans int
	fmt.Scan(&n)

	n *= 2

	l := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}

	sort.Ints(l)

	for i := 0; i < n; i += 2 {
		ans += l[i]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize, m:usize,
        mut s:Chars,
        mut t:Chars,
    }
    let k = gcd(n as i64, m as i64) as usize;
    let l = n * m / k;
    let mut ok = true;
    if s[0] != t[0] {
        println!("{}", -1);
        return;
    }
    let mut mp = BTreeMap::new();
    for i in 0..n {
        *mp.entry(i * m / k).or_insert('-') = s[i];
    }
    for i in 0..m {
        let ind = i * n / k;
        let v = mp.get(&ind);
        if v != None && v != Some(&t[i]) {
            println!("{}", -1);
            return;
        }
    }
    println!("{}", l);

    pub fn gcd(a: i64, b: i64) -> i64 {
        if b == 0 {
            a
        } else {
            gcd(b, a % b)
        }
    }
}


Measured memory_bytes: 5184