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

using namespace std;

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

    //a(2) = a(1) ^ a(3)
    //a(3) = a(2) ^ a(4)
    
    //a(3) = a(1) ^ a(3) ^ a(4)
    //a(1) ^ a(4) = 0
    
    //a(1) = a(4)   
   
    int n; cin >> n;
    map<int, int> cnt;
    for (int i = 0; i < n; ++i) {
        int x; cin >> x; cnt[x] += 1;
    } 

    if (n % 3) {
        if (cnt.size() > 1) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
        }
    } else {
        if (cnt.size() > 3) { 
            cout << "No\n";
            return 0;
        }
        vector<int> nums;
        for (auto p : cnt) {
            while (p.second >= n / 3) {
                nums.push_back(p.first);
                p.second -= n / 3;
            }   
            if (p.second) {
                cout << "No\n";    
                return 0;
            } 
        }
        assert(nums.size() == 3);
        if (nums[2] == (nums[0] ^ nums[1])) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }

    return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> sw(n);
    for(int i=0;i<m;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int s;
            cin >> s;
            sw[s-1] |= 1<<i;
        }
    }

    int p = 0;
    for(int i=0;i<m;i++){
        int x;
        cin >> x;
        p |= x<<i;
    }

    int ans = 0;
    for(int bit=0;bit<(1<<n);bit++){
        int t = 0;
        for(int s=0;s<n;s++){
            if(bit & (1<<s)){
                t ^= sw[s];
            }
        }
        if(t == p) ans++;
    }
    cout << ans << endl;
}


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

int main() {
	int n;
	cin >> n;
	int m = 0;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (a < m) {
			cout << "No" << endl;
			return 0;
		}
		m = max(m, a - 1);
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int N;
	
	int i,j,k,v;
	
	scanf("%d",&N);
	int a[N];
	
	for(i = 0; i < N; i++)
	{
		scanf("%d",&a[i]);
	}
	
	for(i = 0; i < N; i++)
	{
		if(i != N - 1){printf("%d ",a[i]);}
				else{printf("%d",a[i]);}
	}
	printf("\n");
	
    for(i = 1; i < N; i++)
    {
        v = a[i];
        j = i - 1;
    	while(j >= 0 && a[j] > v)
    	{
    		a[j+1] = a[j];
    		j--;
    	}
    	a[j+1] = v;
    	
    	for(k = 0; k < N; k++)
		{
			if(k != N - 1){printf("%d ",a[k]);}
				else{printf("%d",a[k]);}
		}
    	printf("\n");
    }
	return 0;
}


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

int main(){
    int x;              // ??????????????¨????????°
    int num[100];       // ???????????????????????????
    int max_num = 0;    // ?????§??????
    for (int i=0; i<100; i++){      // ??????????????????
        num[i] = 0;
    }
    while (cin >> x){               // ??????????¨????
        num[x-1] += 1;
    }
    for (int i=0; i<100; i++){      // ?????§??????????¢????
        if (max_num < num[i]){
            max_num = num[i];
        }
    }
    for (int i=0; i<100; i++){      // ?????§?????????????????¨???
        if (num[i] == max_num) {
            cout << i+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
    #include <vector>
    #include <fstream>
    #include <algorithm>
    #include <map>
    #include <set>
    #include <unordered_map>
    #include <unordered_set>
    #include <iomanip>
    #include <math.h>

    using namespace std;
     
    #define pb push_back
    #define f first
    #define s second
    #define endl '\n'
    #define EPS 1e-9
    #define PI acos(-1)
     
    using ll = unsigned long long;
    using pll = pair<ll,ll>;
    using ii = pair<int,int>;
    using vi = vector<int>;
    using vii = vector<ii>;
    using vll = vector<ll>;
    using ui = unsigned int;


    int main() {
        ofstream out("output.txt");
        ios_base::sync_with_stdio(false);
        

        int n;
        cin>>n;
        int a[n];
        for(int i =0;i<n;i++){
            cin>>a[i];
        }
        int res= 0;
        int ant = 1;
        for(int i =0;i<n;i++){
            if(a[i] == ant){
                res++;
                ant++;
            }
        }
        if(res == 0){
            cout<<-1<<endl;
        }
        else cout<<n-res<<endl;

        return 0;
    }   


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 300000
#define INF int(2e9)
int n, cnt[MAX_N + 3][2], ans = INF;
int main()
{
	
	string s;
	cin >> n >> s;
	for(int i = 0; i < n; i++)
	{
		if(s[i] == 'W')
			cnt[i + 1][0]++;
		else
			cnt[i + 1][1]++;
		cnt[i + 1][0] += cnt[i][0];
		cnt[i + 1][1] += cnt[i][1];
	}
	for(int i = 1; i <= n; i++)
	{
		ans = min(ans, cnt[i - 1][0] + (cnt[n][1] - cnt[i][1]));
		
	}
	cout << ans << endl;
}


Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a;
  
  for(int i=0; i<N; ++i){
    long int A;
    cin>>A;
    a.push_back(A);
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int mn=a[N-1];
  
  vector<pair<long int,long int>> p;
  for(int i=0; i<M; ++i){
    long int B,C;
    cin>>B>>C;
    if(C>mn) p.push_back(make_pair(C,B));
  }
  
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  
  int t=0;
  for(int i=0; i<p.size(); ++i){
    if(t>N) break;
    for(int j=0; j<p[i].second; ++j){
      a.push_back(p[i].first);
    }
    t+=p[i].second;
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  long int ans=0;
  
  for(int i=0; i<N; ++i) ans+=a[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 3948
def kaibun(s):
  if s == s[::-1]:
    flg = True
  else:
    flg = False
  return flg

S = input()
N = len(S)
ans = 'Yes'
if kaibun(S):
  pass
else:
  ans = ('No')
if kaibun(S[:(N-1)//2]):
  pass
else:
  ans = ('No')
if kaibun(S[:(-(N-1)//2)-1:-1]):
  pass
else:
  ans = ('No')
print(ans)

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int X;
    cin >> X;
    int rank = 8;
    if (X >= 600) rank = 7;
    if (X >= 800) rank = 6;
    if (X >= 1000) rank = 5;
    if (X >= 1200) rank = 4;
    if (X >= 1400) rank = 3;
    if (X >= 1600) rank = 2;
    if (X >= 1800) rank = 1;

    cout << rank << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : 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)
}
signed main(){
    long long n; cin>>n;
    vector<long long>v(n);
    for(int i=0; i<n;i++)cin>>v[i];
    long long now=1;
    for(int i=0; i<n;i++)now=lcm(now, v[i]);
    cout<<now<<endl;
}

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,x,d = LI()
    if d == 0:
        if x == 0:
            return 1
        return n + 1

    c = collections.defaultdict(list)
    ad = n * (n-1) // 2 * d + x * n
    # print(ad)
    dd = abs(d)*2
    for i in range(n+1):
        u = ad - (x * i + ((i-1) * i // 2) * d) * 2
        k = ad - (x * i + ((n-1 + n-i) * i // 2) * d) * 2
        # print("iku",i,k,u)
        if k > u:
            k,u = u,k
        c[k%dd].append((k,u))

    r = 0
    for k, v in c.items():
        v.sort()
        # print(k,v)
        a,b = v[0]
        for t,u in v[1:]:
            if t <= b:
                if b < u:
                    b = u
            else:
                r += (b-a) // dd + 1
                # print("ab",a,b,(abs(b-a)+dd), dd,r)
                a,b = t,u
        r += (b-a) // dd + 1

    return r


print(main())




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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void)
{
    ll H;
    cin >> H;
    int n = 0;
    while(pow(2,n)<=H){
        n++;
    }
    n--;
    ll ans = 0;
    int i = 0;
    while (i<=n){
        ans += pow(2, i);
        i++;
    }
    cout << ans << endl;

    return 0;
}

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

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

}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define INF 1000000007

int main(){
  ll n,m;
  cin>>n>>m;
  vector<pair<ll,ll> > vp;
  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    a--;
    vp.pb(mp(a,b));
  }
  sort(all(vp));
  priority_queue<ll> pq;
  ll ans = 0;
  ll index = 0;
  rep(i,0,m){
    while(index<n){
      if(vp[index].fi==i){
        pq.push(vp[index].se);
        index++;
      }
      else{
        break;
      }
    }
    if(pq.empty())continue;
    ll a = pq.top();pq.pop();
    ans += a;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3568
x = input()
b = len(x)
ans = ''
for a in range(0,b,2):
    if x[a] == 'R' or x[a] == 'D' or x[a] == 'U':
        ans = 'Yes'
    else:
        ans = 'No'
        break
for a in range(1,b,2):
    if ans == 'No':
        break
    elif x[a] == 'L' or x[a] == 'D' or x[a] == 'U':
        ans = 'Yes'
    else:
        ans = 'No'
        break
print(ans)

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

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

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

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

ll dp[1000000];

map<ll, bool> mp;

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

  ll n, m;  
  cin >> n >> m;
  vector<ll> a(m);
  REP(i, m) { //cin >> a[i];
    ll x = 0;
    cin >> x;
    mp[x] = true;
  }
  
  dp[0] = 1;
  REP(i, n){
    if(mp[i+2] != true){
      dp[i+2] += dp[i];
      dp[i+2] %= MOD;
    }
    if(mp[i+1] != true){
      dp[i+1] += dp[i];
      dp[i+1] %= MOD; 
    }
  }
  /*
  REP(i, n+3){
      cout << dp[i] << endl;
  }
  */
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 7680
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

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




int main(){
    int A; long long B, N;
    std::cin >> A >> B >> N;
    long long x(N);
    if(B-1 <= N) x = B-1;
    std::cout << (A*x/B) - A*(x/B) << std::endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define mod 1000000007
#define inf 1e17
using namespace std;

int main() 
{ 

   int n,k;
   cin>>n>>k;
   vector<int>vec;
   for(int i=0;i<n;i++)
   {
      int x;
      cin>>x;
      vec.pb(x);
   }
   vector<int>dp(n+1,INT_MAX);
   dp[0] = 0;
   dp[1] = abs(vec[0]-vec[1]);
   for(int i=2;i<n;i++)
   {
      for(int j=i-1;j>=i-k;j--)
      {
         if(j>=0)
            dp[i] = min(dp[j] + abs(vec[i]-vec[j]),dp[i]);
      }
      
   }
   cout<<dp[n-1]<<endl;
   

} 

Measured memory_bytes: 1144
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int ans=min(n*a,b);
  print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


ll memo[100010];

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

    int n, m;
    ll mod = 1e9+7;

    cin >> n >> m;

    memo[1] = 1;
    reps(i, 2, 100001){
        memo[i] = i*memo[i-1]%mod;
    }

    ll res = 0;
    if(n==m){
        res = 2 * memo[n] * memo[m] % mod;
    }else if(n+1 == m || n == m+1){
        res = memo[n] * memo[m] % mod;
    }else{
        res = 0;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define H 255

int main(){
  int heap[H];
  int n,i;

  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&heap[i]);

  for(i=1;i<=n;i++){
    printf("node %d: ",i);
    printf("key = %d, ",heap[i]);
    if(i/2 != 0)   printf("parent key = %d, ",heap[i/2]);
    if(2*i <= n)   printf("left key = %d, ",heap[2*i]);
    if(2*i+1 <= n) printf("right key = %d, ",heap[2*i+1]);
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2048
// Author - Kartikeya Gupta
// Codeforces - kartikea_gupta
// Github - kartikcode

#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <typeinfo>
#include <sstream>
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define I insert
#define pb push_back
#define F first
#define S second
#define br "\n"
#define repi(i, a, b) for (ll i = a; i < b; i++)
#define repj(j, a, b) for (ll j = a; j < b; j++)
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector<pii>
#define mod 1000000007
#define lim 100001
#define pi 3.14159265

using namespace std;

ll factorial(ll n)      {    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); }
ll gcd(ll a, ll b)      {    if (a == 0)  return b; else return gcd(b % a, a);}
ll power(ll a, ll n)    {    if (n == 1) return a;else if (n == 0) return 1; else{ ll r = power(a, n / 2);if (n % 2 == 0)    return r * r;    else    return r * a * r;}}
ll nCr(ll n, ll r)      {    return ((factorial(n)) / (factorial(n - r) * factorial(r))); }
double precise(double n){    return floor(pow(10, 250) * n) / pow(10, 250);}

bool anyTwo(int a, int b, int c){
    if((a>=0) and (b>=0)) return true;
    if((c>=0) and (b>=0)) return true;
    if((a>=0) and (c>=0)) return true;
    return false;
}

void solve(){
    string s;
    cin>>s;
    int cnt=0;
    int ans = -1;
    int prev = 0;
    for(int i=0;i<3;i++){
        if(s[i]=='R'){
            prev=1;
            cnt++;
        }
        else{
            ans = max(ans,cnt);
            prev=0;
            cnt=0;
        }
    }
    ans = max(ans,cnt);
    cout<<ans;
}

int main()
{    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
/*#ifndef ONLINE_JUDGE
    // for getting input from input.
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif*/
    ll t;
	t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
	return 0;
}  

Measured memory_bytes: 3604
n = gets.to_i
taro = 0
hanako = 0
n.times do |i|
    a,b = gets.split
    if a == b then
        taro += 1
        hanako += 1
    elsif a <= b then
        hanako += 3
    else
        taro += 3
    end
end
puts "#{taro} #{hanako}"


Measured memory_bytes: 6860
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define fileopen(filename) if (fopen(filename".INP", "r")) {freopen(filename".INP", "r", stdin);freopen(filename".OUT", "w", stdout);}
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,n) for (int i=1;i<=n;++i)
#define eb emplace_back
#define pb push_back
#define memset(a,i) memset(a,i,sizeof(a))
#define upper(v,a) upper_bound(v.begin(), v.end(), a)
#define lower(v,a) lower_bound(v.begin(), v.end(), a)
#define ii pair<int,int>
#define fi first
#define se second
#define endl '\n'
#define gcd __gcd
const int maxn=1e5+3;
const int INF=1e9+1;
bool dp[2005][maxn];

signed main()
{
    fastio;
    int n;cin>>n;dp[0][0]=1;
    int a[n+1],pre[n+1];pre[0]=0;
    rep(i,n)
    {
    	cin>>a[i];
    	pre[i]=pre[i-1]+a[i];
    }
    rep(i,n)for (int j=0;j<=1e5;++j)
    	if (!dp[i][j])
    	{
    		if (j+a[i]<=1e5)dp[i][j]=dp[i-1][j+a[i]] | dp[i-1][abs(j-a[i])];
    		else dp[i][j]=dp[i-1][abs(j-a[i])];
    	}
    for (int i=0;i<=1e5;++i)if (dp[n][i]){cout<<(pre[n]+i)/2;return 0;}
}


Measured memory_bytes: 198864
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

int a[10000];

int main(){
    int n,m;
    while(cin>>n>>m && n){
        rep(i,n) cin>>a[i+1];
        int p = 1;
        int ans = 0;
        rep(i,m){
            int k;
            cin>>k;
            p += k + a[p+k];
            if(!ans && p >= n) ans = i+1;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int main(){
   int n;
   cin >> n;
   vector<int> l(n); 
   rep(i,n) cin >> l[i];
   ll ans=0;
   sort(l.begin(),l.end());
   rep(i,n-1){
       rep1(j,i+1,n){
           int k=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
           ans+=max(k-(j+1),0);
       }
   }
   cout << ans;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> 
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	int n;
	cin >>n;
	VI a(n);
	rep(i,n) cin >>a[i];
	sort(all(a));
	multiset<ll> st;
	rep(i,min(n,10)) rep(j,min(n,10)) if(i!=j){
		ll w= stoll(to_string(a[i]) + to_string(a[j]));
		st.insert(w);
	}
	//for(auto x :st) printf("%lld, ",x); puts("");
	auto it=st.begin(); it++;it++;
	cout << *it <<"\n";
	
	return 0;
}



Measured memory_bytes: 3272
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,n;
  cin>>k>>n;
 float f;
 k = k*500;
  f=k/n;
  if(f>=1)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
}
 

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int n;

int main() {
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n; i+=2) {
		int num = 0;
		for (int j = 1; j <= i; j++) {
			if (i%j == 0)num++;
		}
		if (num == 8)cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    let mut t = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    std::io::stdin().read_line(&mut t).unwrap();

    let s = s.trim().chars();
    let mut t = t.trim().chars();

    let mut cnt = 0;

    for i in s {
        let tmps = i;
        let tmpt = t.next().unwrap();
        if tmps==tmpt {
            cnt += 1;
        }
    }

    println!("{}",cnt);
}

Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args) {
        HashSet<String> set = new HashSet<String>();
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        for (int i = 0; i < n; i++) {
            String command = scanner.next();
            switch (command) {
            case "insert":
                set.add(scanner.next());
                break;
            case "find":
                if (set.contains(scanner.next())) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
                break;
            }
        }
        scanner.close();
    }
}



Measured memory_bytes: 262768
n = int(input())
dl = list(map(int,input().split()))
m = int(input())
tl = list(map(int,input().split()))

from collections import defaultdict
dic1 = defaultdict(int)
dic2 = defaultdict(int)

for d in dl:
    dic1[d] += 1
for t in tl:
    dic2[t] += 1

for t in dic2:
    if dic1[t] < dic2[t]:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 56800
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n, m ,k;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  rep(i, n){
    cin >> a[i];
  }
  rep(i, m){
    cin >> b[i];
  }
  int anum=0, bnum=0;
  ll sum=0;
  while(bnum<m && sum+b[bnum]<=k){
    sum+=b[bnum];
    bnum++;
  }
  while(anum<n && sum+a[anum]<=k){
    sum+=a[anum];
    anum++;
  }
  int ans=anum+bnum;
  for(int i=anum; i<n; i++){
    sum+=a[i];
    while(sum > k){
      if(bnum<=0){
        break;
      }
      bnum--;
      sum-=b[bnum];
    }
    if(sum<=k){
      ans=max(ans, i+1+bnum);
    }
  }

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


Measured memory_bytes: 4820
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	int a[n+1];
	memset(a,0,sizeof(a));
	for(int i=0;i<m;i++)
	{
		int h;
		cin>>h;
		a[h]=1; 
	}
	int to_0=0,to_n=0;
	for(int i=1;i<x;i++) to_0+=a[i];
	for(int i=x+1;i<n;i++) to_n+=a[i];
	cout<<(to_0<to_n?to_0:to_n)<<"\n";
	return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9} >= {x} and {6, 9, 11} >= {y}:
  print("Yes")
elif {1, 3, 5, 7, 8, 10} >= {x} and {3, 5, 7, 8, 10, 12} >= {y}:
  print("Yes")
else :
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

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

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

	// long long?
	ll N;
	cin >> N;

	vector<int> vA(N, 0);
	vector<int> vB(N, 0);
	vector<int> vC(N, 0);
	rep(i, N) {
		cin >> vA[i] >> vB[i] >> vC[i];
	}

	vector<vector<int> > dp(N);
	rep(i, N) dp[i] = vector<int>(3, 0);

	dp[0][0] = vA[0];
	dp[0][1] = vB[0];
	dp[0][2] = vC[0];
	for (int i = 0; i != N-1; ++i) {
		dp[i + 1][0] = max(dp[i][1] + vA[i + 1], dp[i][2] + vA[i + 1]);
		dp[i + 1][1] = max(dp[i][0] + vB[i + 1], dp[i][2] + vB[i + 1]);
		dp[i + 1][2] = max(dp[i][0] + vC[i + 1], dp[i][1] + vC[i + 1]);
	}

	cout << max({ dp[N - 1][0], dp[N - 1][1], dp[N - 1][2] }) << endl;

	return 0;
}


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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int N;
    string S, T;
    cin >> N >> S >> T;

    for(int i = 0;i < N;i++){
        cout << S[i] << T[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
fun f(x : Long) : Long{
    return when(x % 4L){
        0L -> x
        1L -> 1L
        2L -> x + 1L
        else -> 0L
    }
}

fun main(args: Array<String>){
    val (a, b) = readLine()!!.split(" ").map(String::toLong)
    println(f(a - 1).xor(f(b)))
}

Measured memory_bytes: 37892
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let S: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };
    let T: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

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

    // よい文字列を作れるならば|X| = lcm(N, M) である
    let G = gcd(N, M);
    let ans = if (0..G).all(|i| S[i * N / G] == T[i * M / G]) {
        (N * M / G) as i64
    } else {
        -1
    };

    println!("{}", ans);
}



Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
typedef pair<pair<int, int>, pair<int, int>> P;
typedef pair<int, int> Pi;
int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<int>> a(H, vector<int> (W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) cin >> a[i][j];
    }
    int gu = 0, ki = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) {
            if(a[i][j] % 2 == 0) gu++;
            else ki++;
        }
    }
    int cnt = 0;
    queue<P> q;
    int flag = 0;
    for(int i = 0; i < H; i++){
        if(flag == 1) break;
        for(int j = 0; j < W; j++){
            int k;
            if(i % 2 == 0) k = j;
            else k = W - 1 - j;
            if(a[i][k] % 2 == 1) cnt++;
            if(cnt == ki){
                flag = 1;
                break;
            }
            if(cnt % 2 == 1){
                if(i % 2 == 0){
                    if(k == W - 1) q.push(P(Pi(i + 1, k + 1), Pi(i + 2, k + 1)));
                    else q.push(P(Pi(i + 1, k + 1), Pi(i + 1, k + 2)));
                }
                else{
                    if(k == 0) q.push(P(Pi(i + 1, k + 1), Pi(i + 2, k + 1)));
                    else q.push(P(Pi(i + 1, k + 1), Pi(i + 1, k)));
                }
            }
        }
    }
    cout << q.size() << endl;
    while(!q.empty()){
        P v = q.front();
        q.pop();
        Pi v1 = v.first, v2 = v.second;
        printf("%d %d %d %d\n", v1.first, v1.second, v2.first, v2.second);
    }
}

Measured memory_bytes: 6784
def a():
  n,k  = map(int, input().split())
  h = list(map(int, input().split()))
  dp = [0] * n
  for i in range(1, n):
    start = max(0, i - k)
    dp[i] = min([dp[j] + abs(h[j]-h[i]) for j in range(start, i)])  
  print(dp[n-1])
  
if __name__ == '__main__':
  a()

Measured memory_bytes: 13976
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string.h>
#include <stdio.h>

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


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

	ll ans = 1;

	for (int i = 1; i <= n; i++) {
		ans = (ans * i) %  MOD;
	}

	cout << ans << endl;

}


Measured memory_bytes: 256
open System

let nm = stdin.ReadLine().Split() |> Array.map int64
let n = nm.[0]
let m = nm.[1]

let mutable ans = 1L
let sqrt = Math.Sqrt(m |> float) |> int64
for d in [1L..sqrt] do
    if (m % d = 0L) && (d * n <= m) then
        ans <- Math.Max(ans, d)
    if (m % d = 0L) && ((m / d) * n <= m) then
        ans <- Math.Max(ans, (m / d))

printfn "%d" ans


Measured memory_bytes: 15068
#include<stdio.h>
#define N 100

int main(){
    int M[N][N];
    int i,j,n,u,k,v;

    scanf("%d",&n);

    for( i=0; i<n; i++){
        for(j=0; j<n; j++){
            M[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--;
            M[u][v]=1;
        }
    }
    for(i=0; i<n; i++){
        for(j=0; j<n; j++){
            if(j) printf(" ");
            printf("%d",M[i][j]);
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2048
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int,read().split()))

rem = set()
ans = sum(a)//2
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            x = [a[i*n+j], a[i*n+k], a[j*n+k]]
            max_x = max(x)
            if(max_x == x[0]):
                ind = i*n+j
            elif(max_x == x[1]):
                ind = i*n+k
            else:
                ind = j*n+k
            x.sort()
            if(x[2] > x[0]+x[1]):
                print(-1)
                exit()
            elif(x[2] == x[0]+x[1]):
                rem.add(ind)

for i in rem:
    ans -= a[i]

print(ans)

Measured memory_bytes: 88068
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n;
    char s[max], t[max];
    
    scanf("%d%s%s", &n, s, t);
    
    rep(i, n){
        printf("%c%c", s[i], t[i]);
    }
    
    return 0;
}



Measured memory_bytes: 1732
n = int(input())
j = list(map(int, input().split()))
k = [j[0]]
mi = 9999999999

for i in range(1, len(j)):
    k.append(k[i - 1] + j[i])
for m in range(len(k) - 1):
    mi = min(abs(k[n - 1] - 2 * k[m]), mi)

print(mi)

Measured memory_bytes: 24824
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define Fi first
#define Se second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz(x) (int)(x).size()
#define pii pair<int,int>
#define pll pair<ll,ll>

void fsscan(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

void scani(int &x)
{
    register int c = gc();x = 0;int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

int fun(int n)
{
    int res=0;
    int mul=1;
    while(n)
    {
        res+=mul;
        n=n/10;
        mul=mul*10;
    }
    return res;
}



int main()
{
    fsscan();
    int n;
    cin>>n;
    
    for(int i=n;;i++)
    {
        int divi=fun(i);
        if(i%divi==0)
        {
            cout<<i;
            return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
import heapq

class MinCostFlow:
    class Edge:
        def __init__(self,to,cap,rev,cost):
            self.to = to
            self.cap = cap
            self.rev = rev
            self.cost = cost

    def __init__(self,n,inf=1000000007):
        self.n = n
        self.inf = inf
        self.e = [[] for _ in range(n)]

    def add_edge(self, fr, to, cap, cost):
        self.e[fr].append(self.Edge(to,cap,len(self.e[to]),cost))
        self.e[to].append(self.Edge(fr,0,len(self.e[fr])-1,-cost))

    def compute(self,source,sink,f):
        res = 0
        h = [0]*self.n
        prevv = [0]*self.n
        preve = [0]*self.n
        while (f > 0):
            pq = []
            dist = [self.inf]*self.n
            dist[source] = 0
            heapq.heappush(pq,(0,source))
            while pq:
                cost, v = heapq.heappop(pq)
                cost = -cost
                if dist[v] < cost:continue
                for i, edge in enumerate(self.e[v]):
                    if edge.cap > 0 and dist[v] - h[edge.to] < dist[edge.to] - edge.cost - h[v]:
                        dist[edge.to] = dist[v] + edge.cost + h[v] - h[edge.to]
                        prevv[edge.to] = v
                        preve[edge.to] = i
                        heapq.heappush(pq,(-dist[edge.to],edge.to))
            if dist[sink] == self.inf:return -1
            for v in range(self.n):
                h[v] += dist[v]

            d, v = f, sink
            while v != source:
                d = min(d,self.e[prevv[v]][preve[v]].cap)
                v = prevv[v]
            f -= d
            res += d*h[sink]
            v = sink
            while v != source:
                self.e[prevv[v]][preve[v]].cap -= d
                self.e[v][self.e[prevv[v]][preve[v]].rev].cap += d
                v = prevv[v]
        return res


def main():
    v,e,f = map(int,input().split())
    MCF = MinCostFlow(v)
    for _ in range(e):
        a,b,c,d = map(int,input().split())
        MCF.add_edge(a,b,c,d)
    print(MCF.compute(0,v-1,f))

if __name__ == '__main__':
    main()




Measured memory_bytes: 6100
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

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

template<typename T> 
map<T,int> factorize(T x){
    map<T,int> res;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            res[i]++;
        }
    }
    if(x!=1) res[x]++;
    return res;
}

ll a,b;

void solve(){
  cin >> a >> b;
  ll g=gcd(a,b);
  int ans=1;
  map<ll,int> ma=factorize(g);
  for(auto t:ma){
    ans+=1;
  }
  cout << ans << endl;
}

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

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

    int a,b;
    cin>>a>>b;

    if(a<10&&b<10) {
        cout<<a*b<<endl;
    }
    else    cout<<-1<<endl;

    
  
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ) {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

string S, T;

int main()
{
//  ll ans;
  unsigned int i;

  cin >> S >> T;

  if (S.size() + 1 != T.size()) {
    printf("No\n");
    return 0;
  }
  for (i=0; i<S.size(); i++) {
    if (S[i] != T[i]) break;
  }
  if (i<S.size()) {
    printf("No\n");
    return 0;
  }
  printf("Yes\n");

  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

enum { A = 0, Z = 25 };
int main() {
    string s_str;
    while (cin >> s_str && s_str != "#") {
        int n = s_str.length();
        vector<int> s(n), t;
        for (int i = 0; i < n; i++) s[i] = s_str[i] - 'a';
        vector<vector<int>> res;
        int cnt = 0;
        int seen, past, newl;
        for (int mask = 0; mask < (1 << n); mask++) {
            t = s;
            seen = past = newl = 0;
            bool invalid = false;
            for (int i = 0; i < n; i++) {
                if (s[i] != A && seen & (1 << s[i])) {
                    if (!(newl & (1 << s[i]))) {
                        invalid = true;
                        break;
                    }
                }
                if (s[i] == Z) {
                    if (mask & (1 << (n-1 - i))) {
                        invalid = true;
                        break;
                    } else {
                        if (!(newl & (1 << Z))) {
                            invalid = true;
                            break;
                        }
                    }
                } else {
                    if (mask & (1 << (n-1 - i))) {
                        if (past & (1 << s[i])) {
                            invalid = true;
                            break;
                        } else {
                            t[i]++;
                            past |= 1 << s[i];
                            newl |= 1 << t[i];
                        }
                    } else if (s[i] != A) {
                        if (!(past & (1 << s[i])) && !(newl & (1 << s[i]))) {
                            invalid = true;
                            break;
                        }
                    }
                }
                seen |= 1 << s[i];
            }
            if (invalid) continue;
            cnt++;
            res.emplace_back(t);
            if (res.size() == 11) res.erase(res.begin() + 5);
        }
        cout << cnt << endl;
        for (auto v: res) {
            for (int i: v) cout << (char)(i + 'a');
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

// solution for https://atcoder.jp/contests/abc134/tasks/abc134_e

using namespace std;
typedef long long ll;
typedef vector<ll> vl;

int main() {
    ll n; cin >> n;
    vl a;
    for(ll i = 0; i < n; i++) {
        ll num; 
        std::cin >> num;
        a.push_back(num);
    }
    std::multiset<ll> s;
    for(ll i = 0; i < n; i++) {
        if (s.empty() || s.upper_bound(-a[i]) == s.end()) {
            ;
        } else {
            // std::cerr << "remo" << *s.upper_bound(-a[i]) << std::endl;
            s.erase(s.upper_bound(-a[i]));
        }
        s.insert(-a[i]);
    }
    cout << s.size() << endl;
}



Measured memory_bytes: 5748
n = int(input())
if n%10 == 2 or n%10 == 4 or n%10 == 5 or n%10 == 7 or n%10 == 9:
    print("hon")
elif n%10 == 0 or n%10 == 1 or n%10 == 6 or n%10 == 8:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9180