akhauriyash/Code-Regression huggingface dataset:
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (H, W, N): (usize, 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(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let (s_r, s_c): (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()
    };

    // Nステップ目から1ステップ目まで順に駒が落ちる範囲を更新すればよい
    let (l, r, u, d) = (0..(2 * N)).rev()
        .fold((1, W, 1, H), |(l, r, u, d), i|
            if i % 2 == 1 {
                let c = T[i / 2];
                if c == 'L' && l <= r { (l, std::cmp::min(r + 1, W), u, d) }
                else if c == 'R' && l <= r { (std::cmp::max(l - 1, 1), r, u, d) }
                else if c == 'U' && u <= d { (l, r, u, std::cmp::min(d + 1, H)) }
                else if c == 'D' && u <= d { (l, r, std::cmp::max(u - 1, 1), d) }
                else { (l, r, u, d) }
            } else {
                let c = S[i / 2];
                if c == 'L' { (l + 1, r, u, d) }
                else if c == 'R' { (l, r - 1, u, d) }
                else if c == 'U' { (l, r, u + 1, d) }
                else if c == 'D' { (l, r, u, d - 1) }
                else { (l, r, u, d) }
            }
        );
    let ans = if l <= s_c && s_c <= r && u <= s_r && s_r <= d { "YES" } else { "NO" };

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


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
int dp[100001];
int a[100001];
int n;
int k;
long long int mod=1000000007;
int max_q(int i){
    //cout<<"Function enters"<<endl;
    if(i>=n-1){
        return 0;
    }
    int m=INT_MAX;
    if(dp[i]!=-1){
        return dp[i];
    }
     
    for(int j=1;j<=min(k,n-1-i);j++){
        m=min(m,abs(a[i]-a[i+j])+max_q(i+j));
    }
    dp[i]=m;
        //dp[i]=min(abs(a[i]-a[i+1])+max_q(i+1),abs(a[i]-a[i+2])+max_q(i+2));
        //dp[i][j][k]=max(dp[i][j][k],longest_sub(i,j,k+1));
        
    return dp[i];
    
}
int main() 
{ 
    for(int i=0;i<=100000;i++){
        dp[i]=-1;
    }
    cin>>n>>k;
    for(int i =0;i<n;i++){
        cin>>a[i];
    }
    cout<<max_q(0);
	return 0; 
} 

Measured memory_bytes: 5760
#include<bits/stdc++.h>
//#include<windows.h>
using namespace std;
long long ans,x,y,z,n,m,i,j,l,h,q,dp[1005]= {0},w[105],s[105],k,t,mx=0,mn=1e9+7;
//inline int read() {
//	char ch=getchar();
//	int x=0,f=1;
//	while(ch<'0'||ch>'9') {
//		if(ch=='-') f=-1;
//		ch=getchar();
//	}
//	while(ch>='0'&&ch<='9') {
//		x=x*10+(ch^48);
//		ch=getchar();
//	}
//	return x*f;
//}
int main() {
	string s1,s2;
	cin>>s1>>s2;
	for(i=0;i<s1.size();i++){
		if(i==s1.size()-1&&s1.size()!=s2.size())cout<<s1[i];
		else cout<<s1[i]<<s2[i];
	}
	return 0;
}

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

int main()
{
  int a[3];
  rep(i,3){
    cin >> a[i];
  }
  sort(a,a+3);
  cout << a[0]+a[1] << endl;
  return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

/*
Range Sum Query by FenwickTree(Binary Indexed Tree)

total number: n
queries:
    1. add(i, val): bit[i] += val 
    2. sum(n): sum(bit[0] + ... + bit[n-1])
time complexity: O(log n)
space complexity: O(N)

Self-balancing binary search tree or Segment Tree can do the same, it takes longer to program and complexity also increases.

Thanks: http://hos.ac/slides/20140319_bit.pdf
    
used in ARC031 C, indeednow finalB E, DSL2B(AOJ), ARC033 C, yukicoder No.59
*/

template<typename T> struct RangeSumQuery {
  int N;
  vector<T> dat;

  RangeSumQuery(int N) : N(N) {
    assert(N > 0);
    dat.resize(N, 0);
  }

  void add(int k, T val) {
    assert(0 <= k && k < N);
    for (int x = k; x < N; x |= x + 1) {
      dat[x] += val;
    }
  }

  // [0, k)
  T sum(int k) {
    assert(k >= 0);
    T ret = 0;
    for (int x = k - 1; x >= 0; x = (x & (x + 1)) - 1) {
      ret += dat[x];
    }
    return ret;
  }
  // [l, r)
  T sum(int l, int r) {
    assert(0 <= l && l < r && r <= N);
    return sum(r) - sum(l);
  }

  T index(int k) {
    assert(0 <= k && k < N);
    return sum(k+1) - sum(k);
  }
};

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

  int n, q;
  cin >> n >> q;

  RangeSumQuery<int> bit(n);

  REP(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      bit.add(x-1, y);
    } else if (com == 1) {
      cout << bit.sum(x-1, y) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1524
#include <stdio.h>
int main()
{
    long long int n1, n2, i, gcd,rem,c,d;
    scanf("%lld %lld",&n1,&n2);
    c=n1*n2;
    while(n2!=0)
    {
        rem=n1%n2;
        n1=n2;
        n2=rem;
    }
    gcd=n1;
    d=(c/gcd);
    printf("%lld\n",d);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <stdio.h>

using namespace std;

const int inf = 1e9 + 7;

int main() {

	int n, m;
	cin >> n >> m;
	vector<int> s, t, e;
	while (1) {
		int _s, _t, _e;
		cin >> _s >> _t >> _e;
		if (_s == 0 && _t == 0 && _e == 0) break;
		s.push_back(_s);
		t.push_back(_t);
		e.push_back(_e);
	}
	int l;
	cin >> l;
	vector<vector<int>> b(l, vector<int>(m));
	for (int i = 0; i < l; i++) {
		for (int j = 0; j < m; j++) {
			cin >> b[i][j];
		}
	}

	vector<vector<int>> c(l, vector<int>(n, 0));
	for (int i = 0; i < l; i++) {
		for (int j = 0; j < (int)s.size(); j++) {
			c[i][s[j] - 1] += b[i][t[j] - 1] * e[j];
		}
	}

	for (int i = 0; i < l; i++) {
		for (int j = 0; j < n; j++) {
			if (j != n - 1)
				cout << c[i][j] << " ";
			else
				cout << c[i][j] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 11432
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(y >= x*2 && y <= x*4 && y%2 == 0){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 27080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		m.input();
		m.solve();
		m.output();
	}
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	//	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);

	String S = null;
	int ans = 0;
	
	public void input() throws IOException {
		S = br.readLine();
	}

	public void solve() throws IOException {
		int slen = S.length();
		char[] snx = new char[slen];
		int ptrSnx = 0;
		for(int i=0; i<slen; i++){
			char c = S.charAt(i);
			if(c != 'x')
				snx[ptrSnx++] = c;
		}
		
		for(int i=0; i<ptrSnx/2; i++){
			if(snx[i]!=snx[ptrSnx-1-i]){
				ans = -1;
				return;
			}
		}
		
		int ptr1=0;
		int ptr2=slen-1;
		
		while(ptr1<ptr2){
			char c1 = S.charAt(ptr1);
			char c2 = S.charAt(ptr2);
			if(c1 == c2){
				ptr1++;
				ptr2--;
			}else{
				if(c1=='x'){
					ptr1++;
					ans ++;
				}else{
					ptr2--;
					ans ++;
				}
			}
		}
	}
	
	
	public void output() {
		out.println(ans);
		out.flush();
		
	}
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
#define reg register
#define ll long long
using namespace std;
const int MAXN = 310;
const int mod = 1e9 + 7;
int n, m, dp[MAXN][MAXN][MAXN];
struct lim {
  int l, x;
};
vector<lim> vec[MAXN];
bool check(int l, int r, int x) {
  return l <= x && x < r;
}
inline void work() {
  scanf("%d%d", &n, &m);
  for(reg int i = 1; i <= m; ++i) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x), vec[r].push_back((lim) { l, x });
  }
  dp[0][0][0] = 1;
  for(reg int i = 1; i <= n; ++i) {
    int la = 0, ra = i, lb = 0, rb = i;
    for(auto it : vec[i]) {
      int tmp = it.l;
      if(it.x == 1) ra = min(ra, tmp), rb = min(rb, tmp);
      if(it.x == 2) rb = min(rb, tmp), la = max(la, tmp);
      if(it.x == 3) la = max(la, tmp), lb = max(lb, tmp);
    }
    for(reg int j = 0; j < i; ++j) for(reg int k = 0; k < j || !k; ++k) {
      int tmp = dp[i - 1][j][k], c = i - 1;
      if(check(la, ra, j) && check(lb, rb, k)) dp[i][j][k] = (dp[i][j][k] + tmp) % mod;
      if(check(la, ra, c) && check(lb, rb, j)) dp[i][c][j] = (dp[i][c][j] + tmp) % mod;
      if(check(la, ra, c) && check(lb, rb, k)) dp[i][c][k] = (dp[i][c][k] + tmp) % mod;
    }
  }
  int ans = 0;
  for(reg int i = 0; i <= n; ++i) for(reg int j = 0; j <= n; ++j) ans = (ans + dp[n][i][j]) % mod;
  printf("%d\n", ans);
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


Measured memory_bytes: 112896
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<vector>
#include<float.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<numeric>
using  ll = long long;
using namespace std;
const ll M = 1000000007;

int main(){
  int n; cin >> n;
  int lll[201];
  for(int i = 0; i < 2*n; i++){
    cin >> lll[i];
  }
  sort(lll, lll + 2*n);
  int count = 0;
  for(int i = 0; i < 2*n; i++){
    count += lll[i];
    i++;
  }

  cout << count << endl;
}


Measured memory_bytes: 256
import java.util.Scanner
import scala.collection.Searching._

import scala.annotation.tailrec

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def recursion(N: Int, K: Int): Int = {
    if (N == 0) (1) else {
      val x = recursion(N - 1, K)
      math.min(x * 2, x + K)
    }
  }

  def solve(sc: => Scanner): Unit = {
    println(recursion(sc.nextInt, sc.nextInt))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    solve(sc)
  }
}


Measured memory_bytes: 27332
#include "bits/stdc++.h"
using namespace std;

#define ll long long
ll n;
string s="357";

ll shichigosan(string x){
	if(stoll(x)>n){
		return 0;
	}
	int seven=0,five=0,three=0;
	for(int i=0;i<x.size();i++){
		if(x[i]=='7')
			seven++;
		else if(x[i]=='5')
			five++;
		else if(x[i]=='3')
			three++;
	}
	int c;
	if(seven&&five&&three)
		c=1;
	else
		c=0;
	for(int i=0;i<s.size();i++){
		c+=shichigosan(x+s[i]);
	}
	return c;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n;
	cout<<shichigosan("0");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;
int A[210];

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    int count = 0;
    while (true)
    {
        bool exist_odd = false;
        for (int i = 0; i < N; ++i)
        {
            if (A[i] % 2 != 0)
            {
                exist_odd = true;
            }
        }
        if (exist_odd == true)
        {
            break;
        }
        for (int i = 0; i < N; ++i)
        {
            A[i] /= 2;
        }
        ++count;
    }
    cout << count << endl;
}

Measured memory_bytes: 3548
/*
問題文
AliceとBobは、2人で1枚ポーカーを行います。
1枚ポーカーは、トランプを用いて行う2人ゲームです。

今回使用するトランプでは、各カードに 1 から 13 までの数が書かれています。
カードの強さは、カードに書かれている数で決まり，強さの基準は以下の通りです。
弱 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 強

1枚ポーカーは以下の手順で行います。

各プレイヤーは、トランプからカードを1枚選んで、自分の手札とします。
両プレイヤーは、手札を見せ合います。強いカードを持っているプレイヤーが勝ちです。
なお、両プレイヤーの持っているカードの強さが同じ場合は引き分けです。
2人の対戦を眺めていたあなたは、AliceとBobの手札を知ることができます。
Aliceが持っているカードに書かれている数は A 、Bobが持っているカードカードに書かれている数は B です。
2人の代わりに、勝敗を判定するプログラムを作ってください。
*/

#include<iostream>
#include<map>
#include<string>

//mapってどこで使うのかわからなかったので、mapが使えた事とこの発想が自力で出てきて嬉しい
//がもっと頭の良い方法ないですか…

//ある程度順序に従った数値の強さ比べ

int main() {
	const int max = 13; //使用するトランプは13枚より　13
	const int singularity = 1; //今回はポーカーなので1が特異性　大富豪の場合には2が一番強いので2をここに代入する
	const int adjustment = 1;  //トランプは１から始まるので0から始めるプログラムに調節する(1から始めてもいいですがint i=1ってかっこ悪いので却下 int i=0)

	int alice, bob;
	std::string result;
	std::map<int,int> mp;

	for (int i = max; i > 0;i--) {
		if (i > singularity) {
			mp[i] = i - singularity - adjustment;  //max==13から減っていき
		}
		else {
			mp[i] = max + i - singularity - adjustment;      //singularityより数値が小さい方とき、現在ある最大の数値の次の数値を代入する　ポーカー(const int singularity = 1)の時、「１」の強さが「12(0～12の13枚のうち最強)」　大富豪(const singularity = 2)の時、「1」の強さが「11(0～12の13枚のうち二番目に強い)、「2」の強さが「12(0～12の13枚のうち最強)」
		}
	}

	/*
	for (auto&& x : mp) {
		std::cout<<x.first<<" "<<x.second<<std::endl; //mpの確認
	}
	*/

	std::cin >> alice >> bob;

	mp[alice]>mp[bob]? result = "Alice" : mp[alice] < mp[bob] ? result = "Bob" : result = "Draw";

	std::cout << result << std::endl;

	return 0;
}


//手動git_ver_1
/*
mp[2] = 0;
mp[3] = 1;
mp[4] = 2;
mp[5] = 3;
mp[6] = 4;
mp[7] = 5;
mp[8] = 6;
mp[9] = 7;
mp[10] = 8;
mp[11] = 9;
mp[12] = 10;
mp[13] = 11;
mp[1] = 12;
*/

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
   cin >> d[i]; 
  }
  int ans=0;
  for(int i=0; i<N; i++){
    for(int j=0; j<i; j++){
      ans+=d[i]*d[j];
    }
  }
  cout << ans <<endl;
}

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

int N;
double p[3000];
double dp[3000][3000]; //dp[i][j] : [0~i]의 동전 중 앞면의 개수가 j일 확률

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
	cin >> N;
	for (int i = 0; i < N; i++) cin >> p[i];
	dp[0][0] = 1 - p[0], dp[0][1] = p[0];
	for (int i = 1; i < N; i++)
		for (int j = 0; j <= i + 1; j++) {
			dp[i][j] = dp[i - 1][j] * (1 - p[i]);
			if (j - 1 >= 0) dp[i][j] += dp[i - 1][j - 1] * p[i];
		}
	double ans = 0;
	for (int i = N / 2 + 1; i <= N; i++) ans += dp[N - 1][i];
	printf("%.10lf\n", ans);
	return 0;
}

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

dp = [[0 for _ in range(3)] for _ in range(N+1)] # i日目までの活動で最終i日目に活動jを行った時の幸福度の最大値をdp[i][j]にしまう

for i in range(N):
    dp[i+1][0] = max(dp[i][1] + a[i][0], dp[i][2] + a[i][0])
    dp[i+1][1] = max(dp[i][2] + a[i][1], dp[i][0] + a[i][1])
    dp[i+1][2] = max(dp[i][0] + a[i][2], dp[i][1] + a[i][2])

ans = max(dp[N])
print(ans)

Measured memory_bytes: 47344
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 214748364700000
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int N, M;
int A[100010];
int acc[100010];
MII cnt;


void makeAcc(){
	repe(i, 1, N) acc[i] = acc[i-1]+A[i-1];
}


void makeCnt(){
	repe(i, 0, N) cnt[acc[i]%M]++;
}


int comb2(int n){
	return n*(n-1)/2;
}


int solve(){
	int ans = 0;
	for(PII p : cnt) ans += comb2(p.se);
	return ans;
}


signed main(){
	cin >> N >> M;
	rep(i, 0, N) cin >> A[i];

	makeAcc();
	makeCnt();

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 5760
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for(int i = 0; i < n; i++){
			char c = sc.next().charAt(0);

			int index = 0;
			switch(c){
			case 'M':
				index = 0;
				break;
			case 'A':
				index = 1;
				break;
			case 'R':
				index = 2;
				break;
			case 'C':
				index = 3;
				break;
			case 'H':
				index = 4;
				break;
			default :
				continue;
			}

			count[index]++;
		}

//		for(int i = 0; i < 5; i++){
//			System.out.println(count[i]);
//		}

		dfs(0, -1);

		System.out.println(result);
	}

	static int count[] = new int[5];
	static int index[] = new int[3];
	static long result = 0;

	static void dfs(int depth, int prevIndex){
		if(depth == 3){
			long tmp = 1;

			for(int i = 0; i < 3; i++){
//				System.out.print(index[i] + " ");
				tmp *= count[index[i]];
			}
//			System.out.println("tmp "+tmp);

			result += tmp;

			return;
		}

		for(int i = prevIndex + 1; i < 5; i++){
			index[depth] = i;
			dfs(depth + 1, i);
		}
	}


}


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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

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


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// int n;
	// cin>>n;
	string s;
	cin>>s;
	if(s=="ARC")
		cout<<"ABC";
	else cout<<"ARC";

}

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

using namespace std;

#define int long long
int mod = 998244353;
int dp[3005][3005];

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (int i = a; i <= c; ++i) {
        for (int j = b; j <= d; ++j) {
            if (i == a && j == b) continue;
            dp[i][j] = (dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * (i - 1) * (j - 1) + mod * mod) % mod;
        }
    }
    cout << dp[c][d] << '\n';
    return 0;
}



Measured memory_bytes: 73968
#include<stdio.h>
int main()
{
	int N,K,X,Y,sum=0;
	scanf("%d%d%d%d",&N,&K,&X,&Y);
	if(N<=K)sum=X*N;
	else if(N>K)sum=X*K+(N-K)*Y;
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m; cin >> n >> m;
    vector<bool> to_n(n+5,false);
    vector<int> from_0(n);
    int j = 0;
    for(int i = 0; i < m; i++){
        int a,b; cin >> a >> b;
        a--; b--;
        if(a == 0) {from_0[j] = b; j++;} 
        if(b == n-1) to_n[a] = true;

    }

    bool f = false;
    for(int i = 0; i < j; i++){
        if(to_n[from_0[i]]){
          f = true;
          break;
        }
    }
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

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

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

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) {
    string ss;
    cin >> ss;
    sort(ss.begin(), ss.end());
    s[i] = ss;
  }
  string res = "";
  rep(i, 26) {
    char c = 'a' + i;
    int cnt = INT_MAX;
    rep(j, n) {
      int tmpCnt = 0;
      rep(k, s[j].size()) {
        if (s[j][k] == c) {
          tmpCnt++;
        }
      }
      cnt = min(cnt, tmpCnt);
    }
    if (cnt > 0) {
      rep(i, cnt) {
        res += c;
      }
    }
  }
  cout << res << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

bool dpx[10000][20001];
bool dpy[10000][20001];

void solve_abc_d() {
	ll n;
	string s;
	string ans = "No";

	cin >> s;
	n = s.size();

	ll x, y;
	cin >> x >> y;

	V xv, yv;
	ll val = 0;
	ll cnt = 0;
	rep(i, n) {
		if (s[i] == 'F') {
			val++;
		}
		else {
			if (cnt % 2 == 0) {
				xv.push_back(val);
			}
			else {
				yv.push_back(val);
			}
			cnt++;
			val = 0;
		}
	}
	if (val != 0) {
		if (cnt % 2 == 0) {
			xv.push_back(val);
		}
		else {
			yv.push_back(val);
		}
	}

	const ll offset = 10000;
	dpx[0][offset] = true;
	rep(i, xv.size()) {
		rep(j, offset * 2) {
			if (dpx[i][j]) {
				if (i == 0) {
					dpx[i + 1][j + xv[i]] = true;
				}
				else {
					dpx[i + 1][j + xv[i]] = true;
					dpx[i + 1][j - xv[i]] = true;
				}
			}
		}
	}
	if (!dpx[xv.size()][x + offset]) {
		cout << "No" << endl;
		return;
	}

	dpy[0][offset] = true;
	rep(i, yv.size()) {
		rep(j, offset * 2) {
			if (dpy[i][j]) {
				dpy[i + 1][j + yv[i]] = true;
				dpy[i + 1][j - yv[i]] = true;
			}
		}
	}

	if (!dpy[yv.size()][y + offset]) {
		cout << "No" << "\n";
		return;
	}

	cout << "Yes" << "\n";
}

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

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 154496
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

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


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static int gcd[][];

	public static void gcdinit(int n) {
		gcd = new int[n + 1][n + 1];
		for (int i = 0; i < n + 1; ++i) {
			for (int j = 0; j < n + 1; ++j) {
				gcd[i][j] = -1;
			}
		}
	}

	public static int gcd(int a, int b) {
		if(gcd[a][b] != -1)return gcd[a][b];
		if (a < b) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		if (b == 0)
			return gcd[a][b] = a;
		int r = a % b;
		return gcd[a][b] = gcd(b, r);
	}

	public static int gcd(int a, int b, int c) {
		return gcd(gcd(a, b), c);
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		gcdinit(k);
		sc.close();
		long ans = 0;
		for(int i = 1; i <= k; ++i){
			for(int j = 1; j <= k; ++j){
				for(int l = 1; l <= k; ++l){
					ans += gcd(i, j, l);
				}
			}
		}
		System.out.println(ans);
	}
}


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

int main(){
	int x, y;

	while(1){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}else if(x <= y){
			cout << x << " " << y << endl;
		}else{
			cout << y << " " << x << endl;
		}
	}

	return 0;
}

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

int main(){
	bool poss[4][14];
	for(int i=0;i<4;i++){for(int j=0;j<14;j++){poss[i][j]=false;}}

	int n;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		char mark;
		int num;
		scanf(" %c %d",&mark,&num);
		switch(mark){
		case 'S':
			poss[0][num]=true;
			break;
		case 'H':
			poss[1][num]=true;
			break;
		case 'C':
			poss[2][num]=true;
			break;
		case 'D':
			poss[3][num]=true;
			break;
		}
	}
	for(int i=1;i<=13;i++){
		if(!poss[0][i]){printf("S %d\n",i);}
	}
	for(int i=1;i<=13;i++){
		if(!poss[1][i]){printf("H %d\n",i);}
	}
	for(int i=1;i<=13;i++){
		if(!poss[2][i]){printf("C %d\n",i);}
	}
	for(int i=1;i<=13;i++){
		if(!poss[3][i]){printf("D %d\n",i);}
	}
	return 0;
}

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

#define    ll    long long int

int n, m;
string s;
map<int, int> mp;
map<int, int>::iterator it;
vector<int> v;

int main( )
{
    int i, j, k, l, p;
    cin >> n >> m;
    cin >> s;
    for (i = 0; i <= n; i++)
        if (s[i] == '0')
            mp[i] = 1;
    p = n;
    while ( p != 0 )
    {
        it = mp.lower_bound(p - m);
        if (it == mp.end( ))
        {
            cout << "-1\n";
            return 0;
        }
        if ((*it).first == p)
        {
            cout << "-1\n";
            return 0;
        }
        v.push_back(p - (*it).first);
        p = (*it).first;
    }
    reverse(v.begin( ), v.end( ));
    for (i = 0; i < (int) v.size( ); i++)
    {
        if (i != 0) cout << ' ';
        cout << v[i];
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 5752
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

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

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int x,y,s;
    while(cin>>x>>y>>s){
        int maxi=-1;
        if(x==0 && y==0 && s==0)break;
        
        for(int i=1;i<s-1;i++){
            for(int j=1;j<s-1;j++){
                if((int)(i*(100+x)/100)+(int)(j*(100+x)/100)==s){
                    maxi=max(maxi,(int)(i*(100+y)/100)+(int)(j*(100+y)/100));
                }
            }
        }
        cout<<maxi<<endl;
    }
}

Measured memory_bytes: 1160
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
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=1e9+7;

vector<ll> to[100100];

int main()
{
    ll n,m;
    cin >> n >> m;
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    vector<ll> dist(n,INF),prev(n,-1);
    dist[0]=0;
    queue<ll> q;
    q.push(0);
    while(!q.empty()){
        ll x=q.front();
        q.pop();
        for(auto v:to[x]){
            if(dist[v]!=INF) continue;
            dist[v]=dist[x]+1;
            prev[v]=x;
            q.push(v);
        }
    }
    bool ok=true;
    rep(i,n){
        if(i){
            if(prev[i]==-1){
                ok=false;
                break;
            }
        }
    }
    if(!ok) cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        for(ll i=1;i<n;i++){
            cout << prev[i]+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 13760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll ans=0;
    while (a%2==0&&b%2==0&&c%2==0){
        a/=2;
        b/=2;
        c/=2;
        ans++;
    }
    if (ans>0&&a==b&&b==c&&c==a){
        ans=-1;
    }
    else if (ans>0){
        a%=2,b%=2,c%=2;
        if (a==b&&b==c&&c==a){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
main(void){

    int a[3001],b[3001],i=0,x;

    while(1){
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0 && b[i]==0){
            break;
        }
        i++;
        a[i]=1;
        b[i]=1;
    }
    for(x=0;x<i;x++){
        if(a[x]>b[x]){
            printf("%d %d\n",b[x],a[x]);
        }else{
            printf("%d %d\n",a[x],b[x]);
        }
    }


}


Measured memory_bytes: 2056
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let x:Vec<u64> = read_vec();
    let (n, a, b) = (x[0], x[1], x[2]);
    let r = n % (a + b);

    let ans = (n/(a+b))*a + (if r <= a { r } else { a });
    println!("{}", ans);
}



Measured memory_bytes: 4352
import java.io.*;
// import java.math.*;
import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        int K, X;
        K = Integer.parseInt (arr[0]);
        X = Integer.parseInt (arr[1]);
        StringJoiner sj = new StringJoiner (" ");
        for (int i = X - K + 1; i < X + K; i++)
            sj.add (String.valueOf (i));
        System.out.println (sj.toString());
        return;
    }
}


Measured memory_bytes: 32760
#import decimal
#decimal.getcontext().prec==500 Floatの桁数を500まで増やす
#Decimal(c).sqrt() それで平方根を求める
#Decimal(1) / Decimal(7) 1/7
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
mod=10**9+7
fac=[1,1]
for i in range(2,N*M+1):
    fac.append(fac[-1]*i%mod)
ifac=[pow(n,mod-2,mod) for n in fac]


counterA=Counter(A).most_common()
counterB=Counter(B).most_common()
if counterA[0][1]>1 or counterB[0][1]>1:
    print(0)
    exit()

def P(a,b):
    #print(a,b)
    if b==0:
        return(1)
    if b<0:
        return(0)
    if a<b:
        return(0)

    return(fac[a]*ifac[a-b]%mod)

idxlst=[[A[i],i,1] for i in range(len(A))] + [[B[i],i,0] for i in range(len(B))]
idxlst=sorted(idxlst,key=lambda x:x[0],reverse=True)
usedA=0
usedB=0

lst2=set([i[0] for i in Counter(A+B).most_common() if i[1]==2])
count=1
c=0
while idxlst:

    a,i,Aflag=idxlst.pop()
    #print(a,Aflag,c)
    #print(c)
    if a in lst2:
        idxlst.pop()
        z=a-c-1
        X=N+M-usedA-usedB-2
        if z-X>=1 and X>=1:
            count*=P(z,X)
        else:
            count*=P(z,X)
        usedA+=1
        usedB+=1
        c+=X+1
    elif Aflag:
        z=a-c
        X=M-usedB
        if z-X>=1 and X>=1:
            count*=P(z,X)-P(z-1,X)
        else:
            count*=P(z,X)
        usedA+=1
        c+=X
    else:
        z=a-c
        X=N-usedA
        if z-X>=1 and X>=1:
            count*=P(z,X)-P(z-1,X)
        else:
            count*=P(z,X)
        usedB+=1
        c+=X
    count%=mod
print(count)


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

using namespace std;

struct Rect {
	int w, h;
	Rect(){}
	Rect(int w, int h) : w(w), h(h){}
	bool operator < (const Rect &rhs) const {
		return (w * h < rhs.w * rhs.h);
	}
};

int main()
{
	int n, w, h;

	while (scanf("%d %d %d", &n, &w, &h) && h){
		Rect rects[128];
		rects[0] = Rect(w, h);

		for (int i = 0; i < n; i++){
			int s, p;
			scanf("%d %d", &s, &p);

			Rect tmp = rects[s - 1];
			for (int j = s - 1; j < i; j++){
				rects[j] = rects[j + 1];
			}

			p %= (tmp.h + tmp.w);

			Rect n1, n2;
			if (p <= tmp.w){
				n1.h = n2.h = tmp.h;
				n1.w = p; n2.w = tmp.w - p;
			}
			else {
				p -= tmp.w;
				n1.w = n2.w = tmp.w;
				n1.h = p; n2.h = tmp.h - p;
			}

			if (n1.h * n1.w < n2.h * n2.w){
				rects[i] = n1; rects[i + 1] = n2;
			}
			else {
				rects[i] = n2; rects[i + 1] = n1;
			}
		}

		sort(rects, rects + n + 1);

		for (int i = 0; i <= n; i++){
			printf("%d%c", rects[i].w * rects[i].h, n == i ? '\n' : ' ');
		}
	}

	return (0);
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
 
using namespace std;
 
int main() 
{
    int n,i,flag=1;
    cin>>n;
    vector<int> a(n,0);
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    for(i=n-1;i>0;i--)
    {
        if(a[i-1]-a[i]>1)
        {
            flag=0;
            break;
        }

        else if(a[i-1]>a[i])
        {
            a[i-1]-=1;
        }
    }
    
    
    
    flag==1?cout<<"Yes":cout<<"No";
}


Measured memory_bytes: 640
import sys
input=sys.stdin.readline
n,m,q=map(int,input().split())
num=[[0]*(n+1) for _ in range(n+1)]
for i in range(m):
	l,r=map(int,input().split())
	num[l][r]+=1
for i in range(n):
	for j in range(n):
		num[i+1][j+1]+=num[i+1][j]
for i in range(q):
	p,q=map(int,input().split())
	ans=0
	for i in range(p,q+1):
		ans+=num[i][q]-num[i][p-1]
	print(ans)




Measured memory_bytes: 58332
#include<bits/stdc++.h>
using namespace std;
int x;
int main()
{
     cin>>x;
        int ans=0;
        for(int i=x;i>=2;i--)
        for(int j=sqrt(i);j>=2;j--)
        {
            int t=i;
            int c=0;
            while(t%j==0)
            {
                c++;
                t/=j;
            }
            if(t==1&&c>=2)
            {
                ans=i;
                cout<<i<<endl;
                return 0;
            }
        }
        cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,cnt[200005]={},a[200005]={};
  cin >> n;
  for(int i=0; i<n-1; i++) {
    cin >> a[i];
  }
  for(int i=n-2; i>=0; i--) {
    cnt[a[i]]++;
  }
  for(int i=1; i<=n; i++) {
    cout << cnt[i] << "\n";
  }
}

Measured memory_bytes: 5168
#include<bits/stdc++.h>
#define ll long long
#define N 100100
#define M 1000000007
using namespace std;

ll n,num[N],x,ans,cnt[N];

int main()
{
	ll i,j,p,q;
	cin>>n;
	for(i=1; i<=n; i++)
	{
		scanf("%lld",&num[i]);
		cnt[num[i]]++;
	}
	if(n%2)
	{
		if(cnt[0]!=1)
		{
			cout<<0;
			return 0;
		}
		for(i=2; i<=n; i+=2)
		{
			if(cnt[i]!=2)
			{
				cout<<0;
				return 0;
			}
		}
	}
	else
	{
		for(i=1; i<=n; i+=2)
		{
			if(cnt[i]!=2)
			{
				cout<<0;
				return 0;
			}
		}
	}
	ll ans=1;
	for(i=1;i<=n/2;i++) ans=(ans << 1)%M;
	cout<<ans;
}

Measured memory_bytes: 1792
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    auto s = sread();
    long N = s.to!long();
    long SN = s.map!(c => cast(long)(c - '0'))().sum();
    writeln((N % SN == 0) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

const int MAX = 2000010;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if(n < k)
        return 0;
    if(n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    COMinit();
    int r1, r2, c1, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    ll ans = 0;
    for(int y = c1; y <= c2; y++) {
        ll tmp = (MOD + COM(r2 + y + 1, y + 1) - COM(r1 + y, y + 1)) % MOD;
        (ans += tmp) %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 47104
S = input()
T = input()

if S[0] == T[0] and S[1] == T[1] and S[2] == T[2]:
  print(3)
elif S[0] == T[0] and S[1] == T[1] and S[2] != T[2]: 
  print(2)
elif S[0] != T[0] and S[1] == T[1] and S[2] == T[2]: 
  print(2)
elif S[0] == T[0] and S[1] != T[1] and S[2] == T[2]: 
  print(2)
elif S[0] != T[0] and S[1] != T[1] and S[2] != T[2]: 
  print(0)
else:
  print(1)

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

 int s=1, m, n, i;
 int main(){
    cin >> m >> n;  
   for (i = 0; i < m; i++){
     if ((s * 2) < (s + n)){
       s *= 2;
     }
     else {
       s += n;
     }
   }
   cout << s << endl;
 }

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long r, D, x;
    cin >> r >> D >> x;
    for (int i = 0; i < 10; ++i) {
        x = r*x - D;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;

//const int MAXN = (int)1e5 + 5;

long long solve(long long x) {
    if (x == 1)
        return 1;
    return 2 * solve(x / 2) + 1;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    long long h;
    cin >> h;
    cout << solve(h) << '\n';

    return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>

int main(){
  int a[3];
  scanf("%d %d %d", &a[0], &a[1], &a[2]);
  if (a[0] == a[1]){
    if (a[1] != a[2]) printf("Yes");
    else printf("No");
  }
  else if (a[1] == a[2]){
    if (a[2] != a[0]) printf("Yes");
    else printf("No");
  }
  else if (a[2] == a[0]){
    if (a[0] != a[1]) printf("Yes");
    else printf("No");
  }
  else printf("No");
  return 0;
}

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

#define int long long

signed main(){
    int n;
    cin >>n;
    
    int a[n+1];
    int cur = 0;
    int mx = 0;
    int temp = 0;
    
    for(int i = 1;i<=n;i++){
        cin >> a[i];
        if(i==1 || cur<a[i]){
        cur = a[i];
        mx = max(temp,mx);
        temp = 0;
        }
        else{
            temp++;
            cur = a[i];
            }
        
            
    }
    
    mx = max(mx,temp);
    cout << mx << endl;
    return 0;
    }
    
 
        

Measured memory_bytes: 1024
#include<cstdio>
    #include<cstdlib>
    #include<cassert>
    #include<iostream>
    #define llong long long
    using namespace std;
     
    inline int read()
    {
        int x=0; bool f=1; char c=getchar();
        for(;!isdigit(c);c=getchar()) if(c=='-') f=0;
        for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
        if(f) return x;
        return -x;
    }
     
    const int N = 2e5;
    struct Element
    {
        int u,v,typ;
    } a[N+3];
    int uf[N+3];
    int n,q,c; llong m;
     
    int findfa(int u) {return uf[u]==u?u:uf[u]=findfa(uf[u]);}
     
    int main()
    {
        scanf("%d%lld%d",&n,&m,&q);
        for(int i=1; i<=n; i++) uf[i] = i;
        for(int i=1; i<=q; i++)
        {
            scanf("%d%d%d",&a[i].u,&a[i].v,&a[i].typ); a[i].u++; a[i].v++;
            if(a[i].typ==0)
            {
                int uu = findfa(a[i].u),vv = findfa(a[i].v);
                if(uu!=vv) {uf[uu] = vv;}
            }
        }
        int cnt1 = 0; c = 0;
        for(int i=1; i<=n; i++) {if(i==findfa(i)) c++;}
        for(int i=1; i<=q; i++)
        {
            if(a[i].typ==1)
            {
                cnt1++;
                int uu = findfa(a[i].u),vv = findfa(a[i].v);
                if(uu==vv) {puts("No"); return 0;}
            }
        }
        llong l = cnt1?max(3ll,(llong)c):c-1ll,r = 1ll*c*(c-1ll)/2ll;
        if(m-(n-c)>=l && m-(n-c)<=r) {puts("Yes");}
        else {puts("No");}
        return 0;
    }

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 200020
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,pw3[233],ans[N<<2],cnt,root;
char s[N];
struct node{
	int ch[3],val;
	bool rev;
	void Rev(){
		rev^=1;
		swap(ch[1],ch[2]);
	}
}t[N<<3];
void build(int &u,int dep,int val){
	u=++cnt;
	if(dep==n){
		t[u].val=val;
		return;
	}
	for(int i=0;i<3;++i){
		build(t[u].ch[i],dep+1,val+pw3[dep]*i);
	}
}
inline void pushdown(int u){
	if(t[u].rev){
		for(int i=0;i<3;++i){
			t[t[u].ch[i]].Rev();
		}
		t[u].rev=0;
	}
}
void _plus(int u){
	pushdown(u);
	if(t[u].ch[2])_plus(t[u].ch[2]);
	swap(t[u].ch[1],t[u].ch[2]);
	swap(t[u].ch[0],t[u].ch[1]);
}
void dfs(int u,int dep,int myh){
	if(dep==n){
		ans[t[u].val]=myh;
		return;
	}
	pushdown(u);
	for(int i=0;i<3;++i){
		dfs(t[u].ch[i],dep+1,myh+pw3[dep]*i);
	}
}
int main(){
	n=read();
	pw3[0]=1;
	for(int i=1;i<=n;++i){
		pw3[i]=pw3[i-1]*3;
	}
	build(root,0,0);
	scanf("%s",s+1);
	m=strlen(s+1);
	for(int i=1;i<=m;++i){
		if(s[i]=='S'){
			t[1].Rev();
		}
		else{
			_plus(root);
		}
	}
	dfs(root,0,0);
	for(int i=0;i<pw3[n];++i){
		printf("%d ",ans[i]);
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 21960
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    string S;
    cin >> S;
    if(S == "ABC"){
        cout << "ARC" << endl;
    }else
    {
        cout << "ABC" << endl;
    }
    
}

Measured memory_bytes: 3628