akhauriyash/Code-Regression huggingface dataset:
/*
***************************************************************************
 name  : ITP1_07_A.cpp
 title : Grading
 make  : 2018/08/22 tanabe
***************************************************************************
*/

// Library
#include <iostream> // standard input output object

main(void){
  int m;      // midterm examination
  int f;      // final examination
  int r;      // makeup examination
  int sum;    // sum
  bool judge; // parameters to determine

  // initialized judge = 0
  // continue judge == 0
  for(judge = 0;judge == 0;){
    std::cin >> m >> f >> r; // input "m f r"
    sum = m+f; // sum = m+f
    if(m < 0 && f < 0 && r < 0){
      judge++; // increment judge
    }
    else{
      if(m < 0 || f < 0){
        std::cout << "F" << std::endl; // output "F"
      }
      else{
        if(sum >= 30){
          if(sum >= 50){
            if(sum >= 65){
              if(sum >= 80){                    // sum < 80
                std::cout << "A" << std::endl;   // output "A"
              }
              else{                             // 65 < sum < 80
                std::cout << "B" << std::endl;   // output "B"
              }
            }
            else{                               // 50 < sum < 65
              std::cout << "C" << std::endl;     // output "C"
            }
          }
          else{                                 // 30 < sum < 50
            if(r >= 50){                         // r >= 50
              std::cout << "C" << std::endl;      // output "C"
            }
            else{                                // r < 50
              std::cout << "D" << std::endl;      // output "D"
            }
          }
        }
        else{                                    // sum < 30
          std::cout << "F" << std::endl;          // output "F"
        }
      }
    }
  }

}



Measured memory_bytes: 3136
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::vec::Vec;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        r: usize,
    }
    match r {
        0...1199 => println!("ABC"),
        1200...2799 => println!("ARC"),
        _ => println!("AGC"),
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 N;
int A[21];
int B[21];
int C[21];

void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, N) cin >> B[i];
	rep(i, 0, N-1) cin >> C[i];


	int buffer = -2;
	int ans = 0;
	rep(j, 0, N) {
		ans += B[A[j]-1];

		if (A[j] == buffer+1) {
			ans += C[A[j]-2];
		}

		buffer = A[j];
	}


	cout << ans << endl;

}

Measured memory_bytes: 256
/*author : Yashvardhan
Sunday, June 23, 2019
12:45 PM
*/

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

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

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

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod(pow(takemod(a), mod-2,mod));}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n;
	cin>>n;

	vpi arr;

	for(int i = 0; i < n ; i++){
		int a,b;
		cin>>a>>b;
		arr.pb(mp(b,a));
	}

	sort(arr.begin(),arr.end());
	int curr = 0;
	bool possi = true;
	for(int i = 0; i < n ; i++){
		int d = arr[i].ff;
		curr += arr[i].ss;
		if(curr > d){
			possi = false;
			break;
		}
	}

	if(possi) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	

	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 6256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <time.h>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int a, b, c, K;
    scanf("%d%d%d%d", &a, &b, &c, &K);
    int cnt = 0;
    while (a >= b) {
        b *= 2;
        cnt++;
    }
    while (b >= c) {
        c *= 2;
        cnt++;
    }
    if (cnt <= K) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return;
}

int main()
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for (t = 0; t < T; t++) {
        solve();
    }
#endif
    return 0;
}


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

n_list = list(map(int, input().split()))
K = int(input().split()[0])

n_list = list(sorted(n_list, reverse=True))
n = n_list[0]
for _ in range(K):
    n = n * 2
ans = n + n_list[1] + n_list[2]
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
void dp(int a[],int n,int k){
	int cost[n];cost[0]=0;cost[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		cost[i]=INT_MAX;
		for(int j=i-min(i,k);j<i;j++){
			cost[i]=min(cost[i],abs(a[i]-a[j])+cost[j]);
		}
	}
	cout<<cost[n-1]<<endl;
}
int main(){
	int n,k;cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	dp(a,n,k);
}

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

int N,W,x,y,bad,tot=0,ans=0;
int dp[105][420];

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

    memset(dp,0,sizeof dp);
    cin>>N>>W;


    for(int i=1;i<=N;i++)
    {
        cin>>x>>y;
        if(i==1)
        bad=x;
        x=x-bad;

        for(int j=i;j>=1;j--)
        {
            for(int k=tot;k>=0;k--)
            {
                dp[j][k+x]=max(dp[j][k+x],dp[j-1][k]+y);
               // cout<<"dp["<<j<<"]["<<k+x<<"]= "<<dp[j][k+x]<<endl;
            }
        }
        tot+=x;
    }

    for(int i=0;i<=N;i++)
    {
        for(int j=0;j<=tot;j++)
        {
            if(((1LL*bad*i)+j)<=W && dp[i][j]>ans)
            ans=dp[i][j];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
A = [list(map(int,input().split(" "))) for _ in range(3)]
N = int(input())
ans = 'No'
for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = -1
for i in range(3):
    if A[i] == [-1,-1,-1]:
        ans = 'Yes'
        break
    elif [A[0][i],A[1][i],A[2][i]] == [-1,-1,-1]:
        ans = 'Yes'
        break
    elif [A[j][j] for j in range(3)] == [-1,-1,-1]:
        ans = 'Yes'
        break
    elif [A[0][2],A[1][1],A[2][0]] == [-1,-1,-1]:
        ans = 'Yes'
        break
print(ans)

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

using namespace std;

vector<bool> getbin(long long n) {
    vector<bool> v(41);
    for (int i = 40; i >= 0; i--)
        v[i] = ((1ll << i) & n);
    return v;
}

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

    int zeros[41] = {}, ones[41] = {};
    int n;
    long long k, ans = 0, x = 0;
    cin >> n >> k;
    long long arr[n];

    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        vector<bool> v = getbin(arr[i]);

        for (int i = 0; i <= 40; i++)
            v[i] ? ones[i]++ : zeros[i]++;
    }

    for (int i = 40; i >= 0; i--) {
        bool cur = 0;
        if (ones[i] < zeros[i])
            cur = 1;

        if (cur)
            if (x + (1ll << i) <= k)
                x += (1ll << i);
    }

    for (auto t : arr)
        ans += (t ^ x);

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>

using namespace std;

int main() {
long long int k,a,b;
 long long int sum,h;
  cin >> k >> a >> b;
 
  if(a+2>=b){
   sum=k+1;
  }
  else{
    if(k-a-1>=0){
    sum=sum+b;
    k=k-a-1;//0に初期化
    while(k>=2){
        sum=sum+b-a;
        k=k-2;
    }
    sum=sum+k;
    }
    else{
      sum=k+1;
  }
  }
    cout << sum << endl;
}


Measured memory_bytes: 256
#!/usr/bin/python3

import math
import sys


DEBUG = False


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, S):
    return S.count('R') > S.count('B')


def main():
    N = int(inp())
    S = inp()
    print('Yes' if solve(N, S) else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll a[N];
  map<ll, ll> mp;
  REP(i, N) {
    cin >> a[i];
    mp[a[i]]++;
  }
  ll op = 0;
  ll even = 0;
  for (auto x : mp) {
    ll tmp = x.second;
    if (tmp % 2 == 0) {
      op += tmp / 2 - 1;
      even++;
    } else {
      op += tmp / 2;
    }
  }
  if (even % 2 == 0) {
    op += even / 2;
  } else {
    op += even / 2 + 1;
  }
  cout << N - 2 * op;
  return 0;
}

Measured memory_bytes: 7296
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };




struct Edge
{
	int to, cost;
	Edge(int to, int cost)
		: to(to), cost(cost) {}
};
typedef vector<vector<Edge> > Graph;
void add_edge(Graph& g, int a, int b, int cost)
{
	g[a].push_back(Edge(b, cost));
	g[b].push_back(Edge(a, cost));
}
vector<int> dijkstra(const Graph& g, const vector<int>& s)
{
	const int _INF = 1e9;
	typedef pair<int, int> pint;

	vector<int> dis(g.size(), _INF);
	priority_queue<pint, vector<pint>, greater<pint> > q;

	for (int i = 0; i < s.size(); ++i)
	{
		dis[s[i]] = 0;
		q.push(pint(0, s[i]));
	}
	while (!q.empty())
	{
		pint t = q.top(); q.pop();
		int cur = t.second, d = t.first;

		if (d > dis[cur])
			continue;

		for (int i = 0; i < g[cur].size(); ++i)
		{
			const Edge& e = g[cur][i];
			int next_d = d + e.cost;
			if (next_d < dis[e.to])
			{
				dis[e.to] = next_d;
				q.push(pint(next_d, e.to));
			}
		}
	}

	return dis;
}
int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);

	Graph g(n);
	for (int i = 0; i < m; ++i)
	{
		int a, b, l;
		scanf("%d%d%d", &a, &b, &l);
		--a, --b;
		add_edge(g, a, b, l);
	}
	vector<int> start;
	for (int i = 0; i < k; ++i)
	{
		int s;
		scanf("%d", &s);
		start.push_back(--s);
	}

	vector<int> dis = dijkstra(g, start);

	int res = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < g[i].size(); ++j)
		{
			Edge& e = g[i][j];

			double from_i = (dis[e.to] + e.cost - dis[i]) / 2.0;
			double d = dis[i] + from_i;

			max_swap(res, (int)(d + 0.5 + 1e-9));
		}
	}

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

Measured memory_bytes: 3792
using System.Collections.Generic;
using System.Linq;
using System;

public class Edge
{
    public int to { get; set; }
    public int d { get; set; }
}

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new List<Edge>[n];
        for (int i = 0; i < n; i++) a[i] = new List<Edge>();
        for (int i = 0; i < n - 1; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var s = int.Parse(line[0]);
            var t = int.Parse(line[1]);
            var d = int.Parse(line[2]);
            a[s].Add(new Edge { to = t, d = d });
            a[t].Add(new Edge { to = s, d = d });
        }
        var p1 = goBfs(n, a, 0);
        var ans = goBfs(n, a, p1, "ans");
        Console.WriteLine(ans);
    }
    static int goBfs(int n, List<Edge>[] a, int t, string t2 = "node")
    {
        var distmax = 0;
        var distmaxn = t;
        var q = new Queue<int>();
        var dist = new int[n];
        for (int i = 0; i < n; i++) dist[i] = int.MaxValue;
        var visited = new bool[n];
        q.Enqueue(t);
        visited[t] = true;
        dist[t] = 0;
        while (q.Count() > 0)
        {
            var w = q.Dequeue();
            visited[w] = true;
            foreach (var x in a[w])
                if (!visited[x.to])
                {
                    q.Enqueue(x.to);
                    dist[x.to] = dist[w] + x.d;
                    if (dist[x.to] > distmax) { distmax = dist[x.to]; distmaxn = x.to; }
                }
        }
        if (t2 == "node") return distmaxn;
        return distmax;
    }
}



Measured memory_bytes: 42660
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	REP(i, n){
		cin >> a[i];
		if(a[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	ll result = 1;
	ll prev = 0;
	REP(i, n) {
		prev = result;
		result *= a[i];
		if(result > 1000000000000000000 || result < prev) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 4060
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    string s = read!string;

    char[] buf;
    foreach (c; s) {
        switch (c) {
            case '0': buf ~= '0'; break;
            case '1': buf ~= '1'; break;
            case 'B':
                if (buf.length > 0) {
                    buf = buf[0..$-1];
                }
                break;
            default:
                break;
        }
    }
    writeln(buf);
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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


void Main()
{
    char x,y;cin>>x>>y;

    if(x == y){
        cout << "=" << endl;
    }
    else if(x < y){
        cout << "<" << endl;
    }
    else{
        cout << ">" << endl;
    }

	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;

int main() {
    int n, m; cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
//ABC - 143
//19 - 10 - 2019
#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define MOD 1000000007

int main() {
	int n;
	cin >> n;
	ll ans = 0;
	int a[n];
	for(int i = 0;i < n;i++)
	cin >> a[i];
	for(int i = 0;i < n;i++){
		for(int j = i + 1;j < n;j++){
			ans += a[i]*a[j];
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
 
namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var t1 = new int[1001];
            var t2 = new int[1001];
            var s = "";
            while ((s = Console.ReadLine()) != "")
            {
                var d = int.Parse(s.Split(',')[0]);
                t1[d]++;
            }
            while ((s = Console.ReadLine()) != null)
            {
                var d = int.Parse(s.Split(',')[0]);
                t2[d]++;
            }
            for (int i = 0; i < 1001; i++)
            {
                if (t1[i] > 0 && t2[i] > 0)
                {
                    Console.WriteLine("{0} {1}", i, t1[i] + t2[i]);
                }
            }
        }
    }
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; return(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

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

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    cin >> n;
    vector<pair<string, ll>> v;

    NREP() {
        cin >> s >> a;
        v.emplace_back(s, a);
    }

    cin >> t;

    ans = 0;
    bool flag = false;
    for(auto item : v) {
        if (flag) {
            ans += item.second;
        }
        if (item.first == t) {
            flag = true;
        }
    }
    MSG(ans)
}


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

lol coins[12];
lol dp[100011];
lol n;

void init(){
    coins[0]=1;
    coins[1]=6;
    coins[2]=9;
    coins[3]=36;
    coins[4]=81;
    coins[5]=216;
    coins[6]=729;
    coins[7]=1296;
    coins[8]=6561;
    coins[9]=7776;
    coins[10]=46656;
    coins[11]=59049;
}

int main() {
    init();
    cin >> n;
    dp[0]=0;
    for(lol i=1; i<=n; i++) dp[i]=INT_MAX;
    for(lol i=1; i<=n; i++){
        for(lol j=0; j<12; j++){
            if(coins[j]<=i){
                lol cur=dp[i-coins[j]];
                if(cur!=INT_MAX && (cur+1)<dp[i]) dp[i]=cur+1;
            }
        }
    }
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 1024
class mod_comb_perm:
    def __init__(self,n,mod):
        self.mod = mod
        self.fact = [1 for i in range(n)]
        for i in range(2,n+1):
            self.fact[i-1] = (self.fact[i-2]*i)%mod

    def expo(self,x,n):
        if n == 2:
            return (x * x) % self.mod
        elif n == 1:
            return  x%self.mod
        elif n == 0:
            return 1
        elif n % 2 == 1:
            return (self.expo(x, n - 1) * x) % self.mod
        else:
            temp = self.expo(x, n // 2) % self.mod
            return (temp * temp) % self.mod
    def comb(self,n,k):
        a = (self.fact[n]*self.expo(self.fact[k],self.mod-2))%self.mod
        return (a*self.expo(self.fact[n-k],self.mod-2))%self.mod
    def invm(self,x):
        return (self.expo(self.fact[x],self.mod-2))%self.mod
    def perm(self,n,k):
        return (self.fact[n]*self.expo(self.fact[n-k],self.mod-2))%self.mod



n = int(input())

mcp = mod_comb_perm(n+1,998244353)

arr = list(map(int,input().split()))

flag = True
buf = [0 for i in range(n + 1)]

for i in range(n):
    if i == 0:
        if arr[i] != 0:
            flag = False
            break
    else:
        if arr[i] == 0:
            flag = False
            break
    buf[arr[i]] += 1

if flag:
    ans = 1
    bef = 1
    has_zero = False
    for i in range(1,n+1):
        if buf[i] == 0:
            has_zero = True
            continue

        if has_zero:
            if buf[i] != 0:
                flag = False
                break
        else:
            ans = ans*mcp.expo(bef,buf[i])
            ans %= 998244353

        bef = buf[i]

    if flag:
        print(ans)
    else:
        print(0)

else:
    print(0)



Measured memory_bytes: 17840
let n, q = Scanf.scanf " %d %d" @@ fun a b -> a, b
let g = Array.make n []
let _ = for _ = 1 to n - 1 do Scanf.scanf " %d %d" @@ fun u v -> g.(u - 1) <- v - 1 :: g.(u - 1); g.(v - 1) <- u - 1 :: g.(v - 1) done
let pxs = Array.init q @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a - 1, b
let os, ans = Array.(make n 0, make n 0)
let rec f v p x = ans.(v) <- x + os.(v); List.iter (fun u -> if u <> p then f u v @@ x + os.(v)) g.(v)
let _ = Array.(iter (fun (p, x) -> os.(p) <- os.(p) + x) pxs; f 0 ~-1 0; iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) ans; print_newline ())

Measured memory_bytes: 45308
n = input()
k = int(input())


DP = [[0]*(k+3), [0]*(k+3)]
DP[0][0] = 1

for num in n:
    num = int(num)

    for num_count in range(k+1, -1, -1):
        DP[1][num_count] += DP[1][num_count-1] * 9 + DP[0][num_count-1] * max(0, num-1)

        if num != 0:
            DP[0][num_count] = DP[0][num_count-1] * 1
            DP[1][num_count-1] += DP[0][num_count-1]
            DP[0][num_count-1] = 0

        else:
            continue

ans = DP[1][k] + DP[0][k]
print(ans)



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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
constexpr int mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  friend ostream &operator<<(ostream &os, const mint &a) { return (os << a.x); }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); ++i) s[i] = 'x';
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
//map<key,value>

int main(){
  string s;
  int c=0,ans=0;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='A' || s[i]=='T' || s[i] == 'G' || s[i] == 'C'){
      c++;
    }
    else c=0;
    ans = max(ans,c);
  }
  cout << ans;
}


Measured memory_bytes: 256
from heapq import heappop, heappush
x,y,a,b,c = map(int, input().split())

aa = sorted(map(int, input().split()), reverse=True)
bb = sorted(map(int, input().split()), reverse=True)
cc = sorted(map(int, input().split()), reverse=True)
dd = []
for i in aa[:x]:
    heappush(dd,i)
for i in bb[:y]:
    heappush(dd, i)

for i in range(c):
    heappush(dd, cc[i])
    heappop(dd)

print(sum(dd))


Measured memory_bytes: 23456
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;


int main(){
    int n;cin>>n;
    int a[n];for(int i=0;i<=n-1;i++)cin>>a[i];
    sort(a,a+n);
    int flag=0,i=n-1;
    int fla[2]={0,0};
    while(flag<2&&i>=1){
        if(a[i]==a[i-1]){
            fla[flag]=a[i];
            i--;
            flag++;
        }
        i--;
    }
    printf("%lld",(long long int)fla[0]*fla[1]);
    
    return 0;
}


Measured memory_bytes: 640
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')
mx = max(a,b,c)
mn = min(a,b,c)
if len(s)==1:
    print('YES')
elif len(s)==2 and mx==1:
    print('YES')
elif mx-mn<=1 and a+b+c -mx -mn*2 <=1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include<stdio.h>
int main(){
  int d,t,s;
  double time_takes;
  scanf("%d%d%d",&d,&t,&s);
  time_takes = (double)d / s;
  if( time_takes <= t){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 2092
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#define RE(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define SZ(x) ((int)(x.size()))
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using C = complex<double>;
const double PI = 3.14159265;
const double eps = 1e-8;
const int N = 1e6 +10;
const int M = 1e9 + 7;
const int inf = 1e9+7;
const ll INF = 1e18;
ll pw(ll a, ll b){ll t=1;a%=M;for(;b;b>>=1){if(b&1){t=t*a%M;}a=a*a%M;}return t;}
ll gcd(ll a, ll b){return b?gcd(b, a%b): a;}

vector<pii> g[20];
int main(){
    int n;
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	int ans=0;

	for(int i=0;i<n;i++){
        int q;
        cin>>q;
        int x, y;
        while(q--){
            cin>>x>>y;x--;
            g[i].emplace_back(x, y);
        }
	}
	for(int s=1;s<(1<<n);s++){
        bool f=0;
        for(int i=0;i<n && (!f);i++){
            if((s>>i)&1){
                for(pii j: g[i]){
                    if(j.S ^ (s>>j.F&1)){
                        f=1;
                    }
//                    if(j.S == 1 && ((s>>j.F) == 0)){
//                        f=1;
//                    }
//                    if(j.S == 0 && ((s>>j.F) == 1)){
//                        f=1;
//                    }
                }
            }
        }
        if(!f){
//            cout<<s<<endl;
            ans = max(__builtin_popcount(s), ans);
        }

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

/*
#ifdef DEBUG
	cout<<"I Love Co shu Nie [ https://coshunie.com/ ]"
#endif
*/


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a[]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14, 1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int k;
    scanf("%d",&k);
    printf("%d\n",a[k-1]);
}    



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

#define N 101
#define WHITE 0
#define BRACK 1

main(){
  int n,i,j,v,e,v1;
  int A[N][N];
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      A[i][j]=WHITE;
    }
  }

  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    scanf("%d%d",&v,&e);
    for(j=1;j<=e;j++){
      scanf("%d",&v1);
      A[i][v1]= BRACK;
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d", A[i][j]);
      if(j<n)printf(" ");
    }
    printf("\n");
  }
  
  return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define RANGE(i,n) for(ll i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    ll N;
    cin >> N;
    ll now=1;
    while(now*now < N)now++;
    ll root_r = now;
    ll result = 0;
    for(ll i=1; i<root_r; i++){
        if(N % i == 0 && i < (N/i) -1){
            result += N/i -1;
        }
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a, b, c;
  
  scanf("%d %d", &a, &b);
  
  if(a - b <= a + b)
    c = a + b;
  else
    c = a - b;
  
  if(c <= a * b)
    printf("%d\n", a * b);
  else
    printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var startval int

func solve() {
	n := scanInt()
	k := scanInt()
	a := make([]int, n)
	seen := map[int]bool{}
	trace := []int{0}
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	for i := 0; i < k; i++ {
		next := a[trace[i]] - 1
		_, ok := seen[next]
		if ok {
			startval = next
			break
		}
		trace = append(trace, next)
		seen[next] = true
	}
	var start int
	for i := 0; i < k; i++ {
		if trace[i] == startval {
			start = i
			break
		}
	}
	repetition := trace[start:]
	fmt.Println(repetition[(k-start)%(len(repetition))] + 1)
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 16176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c,d,priceX,priceY;
    cin>>n>>a>>b>>c>>d;
    if (n%a==0) {
        priceX=(n/a)*b;
    } else {
        priceX=((n/a)+1)*b;
    }
    if (n%c==0) {
        priceY=(n/c)*d;
    } else {
        priceY=((n/c)+1)*d;
    }
    if (priceX<priceY) {
        cout<<priceX<<endl;
    } else {
        cout<<priceY<<endl;
    }
}


Measured memory_bytes: 3124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

static class CodeJam
{
    class Solver
    {
        private int N;
        private string S;

        public Solver(int N, string S)
        {
            this.N = N;
            this.S = S;
        }

        public long Solve(int k)
        {
            long C = 0;
            var D = new long[N];
            var M = new long[N];
            var DM = new long[N];
            for (int i = 0; i < N; ++i)
            {
                if (i > 0)
                {
                    D[i] = D[i - 1];
                    M[i] = M[i - 1];
                    DM[i] = DM[i - 1];
                }
                if (i >= k)
                {
                    switch (S[i - k])
                    {
                    case 'D':
                        --D[i];
                        DM[i] -= M[i];
                        break;
                    case 'M':
                        --M[i];
                        break;
                    }
                }
                switch (S[i])
                {
                case 'D':
                    ++D[i];
                    break;
                case 'M':
                    ++M[i];
                    DM[i] += D[i];
                    break;
                case 'C':
                    C += DM[i];
                    break;
                }
            }
            return C;
        }
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        var solver = new Solver(N, S);
        int Q = int.Parse(Console.ReadLine());
        int[] K = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        foreach (int k in K)
        {
            Console.WriteLine(solver.Solve(k));
        }
    }
}


Measured memory_bytes: 39224
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	string s;
	cin >> s;
	int cnt[30] = {};
	for(int i = 0; i < 4; i++){
		cnt[s[i]-'A']++;
	}
	int flag = 1;
	for(int i = 0; i < 30; i++){
		if(cnt[i] != 0 && cnt[i] != 2) flag = 0;
	}
	cout << (flag ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 384
# coding: utf-8

import math
import re
import numpy as np
import copy

#読み込む
S = input()

if S == "RRR":
    print(3)
elif S == "RRS" or S == "SRR":
    print(2)
elif "R" in S:
    print(1)
else:
    print(0)



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

using namespace std;

#define int long long

void solve() {
    int a, b;
    cin >> a >> b;
    if (b < a) swap(a, b);
    if (b == 2) cout << 3;
    else if (a == 1) cout << 2;
    else cout << 1;
}

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


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,d=0,i=0,n=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int hana1[] = new int[51];
    int hana2[] = new int[51];



    while(true){
    try{
      String line = reader.readLine();
      String[] splitted = line.split(" ");
      a = Integer.parseInt(splitted[0]);
      b = Integer.parseInt(splitted[1]);
      for (i=1;i<=a;i++){ 
        hana1[i] = a - i + 1;
      }
      if (a+b == 0) break;
      for(m=0;m<b;m++){
        line = reader.readLine();
        splitted = line.split(" ");
        c = Integer.parseInt(splitted[0]);
        d = Integer.parseInt(splitted[1]);
        for(i=c;i<c+d;i++) hana2[i-c+1] = hana1[i];
        for(i=1;i<c;i++) hana2[i+d] = hana1[i];
        for(i=1;i<c+d;i++) hana1[i] = hana2[i];
      }
      System.out.println(hana1[1]);



		}catch(Exception e){
      break;
    }





  }



  
	}
}


Measured memory_bytes: 27868
s = [0]
M = 10**6
p = [1]*M
S = 0
for i in range(2,M):
    if p[i]:
        for j in range(i*i,M,i):
            p[j] = 0
        S += i; s.append(S)
while 1:
    n = input()
    if n==0: break
    print s[n]

Measured memory_bytes: 59680
N = gets.to_i
as, bs = [], []
N.times do |i|
    as[i], bs[i] = gets.split.map(&:to_i)
end
as.reverse!
bs.reverse!

ans = 0
N.times do |i|
    as[i] += ans
    ans += (bs[i] - as[i] % bs[i]) % bs[i]
end

puts ans

Measured memory_bytes: 3436
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int h = scanner.nextInt();
        int w = scanner.nextInt();
        char[][] grid  = new char[h + 1][w + 1];
        for (int i = 1; i <= h; ++i) {
            String current = scanner.next();
            for (int j = 1; j <= w; ++j) {
                grid[i][j] = current.charAt(j - 1);
                //System.out.println("current: " + current);
            }
        }
        int [][] dp = new int[h + 1][w + 1];
        for (int i = 1; i <= h; ++i) {
            for (int j = 1; j <= w; ++j) {
                dp[i][j] = 100000;
            }
        }
        if (grid[1][1] == '#') {
            dp[1][1] = 1;
        } else {
            dp[1][1] = 0;
        }
        for (int i = 1; i <= h; ++i) {
            for (int j = 1; j <= w; ++j) {
                if (i == 1 && j == 1) {
                    continue;
                }
                if (grid[i][j] == '.') {
                    if (i - 1 >= 1 && j - 1 >= 1) {
                        dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - 1]);
                    } else if (i - 1 >= 1) {
                        dp[i][j] = dp[i - 1][j];
                    } else if (j - 1 >= 1) {
                        dp[i][j] = dp[i][j - 1];
                    }
                } else {
                    if (i - 1 >= 1) {
                        if (grid[i - 1][j] == '#') {
                            dp[i][j] = dp[i - 1][j];
                        } else {
                            dp[i][j] = dp[i - 1][j] + 1;
                        }
                    }
                    if (j - 1 >= 1) {
                        if (grid[i][j - 1] == '#') {
                            dp[i][j] = Math.min(dp[i][j], dp[i][j - 1]);
                        } else {
                            dp[i][j] = Math.min(dp[i][j], dp[i][j - 1] + 1);
                        }
                    }
                }
           //     System.out.println("dp[" + i + "][" + j + "]: " + dp[i][j] );
            }
        }
        System.out.println(dp[h][w]);
    }
}


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

int main() {
  int n,a;
  cin >>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%2==0){
      if(a%3==0||a%5==0){
        continue;
      }
      else{
        cout <<"DENIED" <<endl;
        return 0;
      }
    }
  }
  cout <<"APPROVED" <<endl;
}


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

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

    int n = s.size();
    vector<int> l(n), r(n), ans(n);

    r[0] = l[n - 1] = 1;
    for (int i = 1; i < n; i++)
    {
        if (s[i] == 'R')
            r[i] = r[i - 1] + 1;
    }
    for (int i = n - 2; i > -1; i--)
    {
        if (s[i] == 'L')
            l[i] = l[i + 1] + 1;
    }
    for (int i = 0; i < n - 1; i++)
    {
        if (r[i] * l[i + 1] == 0)
            ans[i] = 0;
        else
        {
            int x = r[i] + l[i + 1];
            if (x % 2 == 0)
                ans[i] = ans[i + 1] = x / 2;
            else if(x % 2 != 0 && r[i] % 2 == 0)
            {
                ans[i] = (x - 1) / 2;
                ans[i + 1] = (x + 1) / 2;
            }
            else if(x % 2 != 0 && r[i] % 2 != 0)
            {
                ans[i] = (x + 1) / 2;
                ans[i + 1] = (x - 1) / 2;
            }
            i++;
        }
    }
    for (int i = 0; i < n;i++){
        cout << ans[i] << " ";
        cout << endl;
    }
}

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

int main() {
    int N;
    cin >> N;
    int NN=N;
    int f=0;
    while(NN!=0) {
        int tmp;
        tmp=NN%10;
        f+=tmp;
        NN-=tmp;
        NN/=10;
    }
    if (N%f==0) {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3604
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int a,b;

int main()
{
	cin>>a>>b;
	if(b%a==0) cout<<a+b<<endl;
	else cout<<b-a<<endl;
	rt0;
}

Measured memory_bytes: 256