akhauriyash/Code-Regression huggingface dataset:
// Branch on Condition - Circle in a Rectangle
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_D
using System;
using System.Linq;

namespace NTL_2_D {
	class Program {
		public Program() {}
		
		public static void Main() {
			new Program().Calc();
		}
		
		void Calc() {
			var n = Input.Split(' ')
                            .Select(i => int.Parse(i))
			                .ToArray();
			Output(judge(n) ? "Yes" : "No");
		}
		
		String Input {
			get {
				return Console.ReadLine();
			}
		}
		
		void Output(String str) {
			Console.WriteLine(str);
		}
		
		bool judge(int[] n) {
            if(0 > n[2] - n[4]) return false;
            if(0 > n[3] - n[4]) return false;
            if(n[0] < n[2] + n[4]) return false;
            if(n[1] < n[3] + n[4]) return false;
            return true;
		}
	}
}

Measured memory_bytes: 9428
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int main(){
  int cc[50][50];
  int n,c;
  cin>>n>>c;
  int col[4][31];

  for(int i=0;i<3;i++){
    for(int j=0;j<c;j++)col[i][j]=0;
  }

  for(int i=0;i<c;i++){
    for(int j=0;j<c;j++){
      cin>>cc[i][j];
    }
  }

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int tmp;
      cin>>tmp;
      col[(i+j)%3][tmp-1]++;
    }
  }

  /*cout<<col[0][0]<<endl;
  for(int i=0;i<3;i++){
    for(int j=0;j<c;j++)cout<<col[i][j]<<" ";cout<<endl;
  }*/

  long long ans = 501LL*500*1000;
  for(int i=0;i<c;i++){
    for(int j=0;j<c;j++){
      for(int k=0;k<c;k++){
        if(i==j) continue;
        if(j==k) continue;
        if(k==i) continue;

        long long tmp = 0;

          for(int m=0;m<c;m++){
            tmp+=(long long)((long long)col[0][m]*(long long)cc[m][i]);
            tmp+=(long long)((long long)col[1][m]*(long long)cc[m][j]);
            tmp+=(long long)((long long)col[2][m]*(long long)cc[m][k]);
          }
        //cout<<tmp<<endl;

        ans = min(tmp,ans);
      }
    }
  }

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

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
    PrintWriter out = new PrintWriter(System.out);
    final long mod = 1000000000+7;
    public static void main(String[] args) {
        Main main = new Main();
        System.out.println(main.solve());
    }
    // segment tree to record minimum value
    // Each point has a infinite distance from 0 (except itself)
    long solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), T = sc.nextInt();
        int[][] weight_value = new int[n][2];
        for(int i=0;i<n;i++){
            int w = sc.nextInt(), v = sc.nextInt();
            weight_value[i][0] = w; weight_value[i][1] = v;
        }
        // put the one with smaller weight at front
        Arrays.sort(weight_value,(o1,o2)->(o1[0]==o2[0]?o1[1]-o2[1]:o1[0]-o2[0]));
        // note that traditional back-pack ends at sum(weight)=T-1
        int[][] dp = new int[n+1][T+1];
        for(int i=1;i<=n;i++){
            int w = weight_value[i-1][0], v = weight_value[i-1][1];
            int maxi = 0;
            for(int j=0;j<T;j++){
                dp[i][j] = dp[i-1][j];
                if(j>=w){
                    dp[i][j] = Math.max(dp[i][j], dp[i-1][j-w]+v);
                }
                maxi = Math.max(maxi, dp[i-1][j]);
            }
            // finally the tricky "tail"
            dp[i][T] = Math.max(dp[i-1][T], maxi+v);
        }
        long ans = 0;
        for(int j=0;j<=T;j++) ans = Math.max(ans, dp[n][j]);
        return ans;
    }
}



Measured memory_bytes: 69864
x = int(input())
if x<11:
    print(1 if x <= 6 else 2)
else:
    ans = x // 11 * 2
    x -= (x // 11) * 11
    if x != 0 and x <= 6:
        ans += 1
    elif x != 0 and x>6:
        ans += 2
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<char, ll> mp;

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

typedef pair<Weight, Edge> P;

int main()
{
	int n;
	cin >> n;
	ll prod = 1;
	FOR(i, 1, n) prod = prod*(i+1)%MOD;
	cout << prod << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b==c+d)
        cout<<"Balanced\n";
         else if(a+b>c+d)
        cout<<"Left\n";
         else if(a+b<c+d)
        cout<<"Right\n";

    return 0;
}


Measured memory_bytes: 3524
#include<stdio.h>
#include<string.h>

int main(){
	char a[11], b[11], c[11];
	int d, e;
	scanf("%s %s\n", &a, &b);
	scanf("%d %d\n", &d, &e);
	scanf("%s", &c);
	
	if(strcmp(a, c) == 0) {
		printf("%d %d", d - 1, e);
	}
	else if (strcmp(b, c) == 0){
		printf("%d %d", d, e - 1);
	}
		
	return 0;
}

Measured memory_bytes: 3224
//---------- begin union_find ----------
mod union_find {
    pub struct UF {
        p: Vec<i32>,
    }
    #[allow(dead_code)]
    impl UF {
        pub fn new(n: usize) -> UF {
            UF {p: vec![-1; n] }
        }
        pub fn init(&mut self) {
            for p in self.p.iter_mut() {
                *p = -1;
            }
        }
        pub fn root(&mut self, mut x: usize) -> usize {
            while self.p[x] >= 0 {
                x = self.p[x] as usize;
            }
            x
        }
        pub fn same(&mut self, x: usize, y: usize) -> bool {
            self.root(x) == self.root(y)
        }
        pub fn unite(&mut self, mut x: usize, mut y: usize) {
            x = self.root(x);
            y = self.root(y);
            if x == y {
                return;
            }
            if self.p[x] > self.p[y] {
                let s = x;
                x = y;
                y = s;
            }
            self.p[x] += self.p[y];
            self.p[y] = x as i32;
        }
        pub fn get_size(&mut self, x: usize) -> usize {
            let r = self.root(x);
            (-self.p[r]) as usize
        }
    }
}
//---------- end union_find ----------
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        s: String,
        m: usize,
        p: [(usize1, usize); m],
    }
    let a: Vec<u32> = s.chars().map(|c| c as u32 - 'a' as u32).collect();
    let n = a.len();
    let mut u = union_find::UF::new(n + 1);
    for (l, r) in p {
        u.unite(l, r);
    }
    for i in 0..n {
        u.unite(i, n - i);
    }
    let mut dp = vec![0; n + 1];
    dp[u.root(0)] += a[0];
    for i in 1..n {
        dp[u.root(i)] += (a[i] - a[i - 1] + 26) % 26;
    }
    dp[u.root(n)] += 26 - a[n - 1];
    for i in 0..(n + 1) {
        if dp[i] % 26 != 0 {
            println!("NO");
            return;
        }
    }
    println!("YES");
}

fn main() {
    run();
}


Measured memory_bytes: 8444
#include <iostream>
#include <array>
#include <vector>
#include <map>
#include <utility>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <string>
#include <limits.h>

using namespace std;
int main(){
    int n;
    cin >> n;
    int sum;
    int ii = 0;
    for (int i = 1; i <= n; i++) {
        sum += i;
        ii = i;
        if (sum > n) {
            break;
        }
    }
    int ex = sum - n;
    for (int i = 1; i <= ii; i++) {
        if (ex == i) {
            continue;
        }
        cout << i << endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define ll long long
#define ull unsigned long long

int main() {
    int a[3] = {};
    rep(i, 3) cin >> a[i];
    sort(a, a + 3);
    if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
        YES;
    } else {
        NO;
    }
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
	
	public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			int n;
			int h;
			int index;
			int index2;
			int result=1;
			Map <Integer,Integer> map = new HashMap<Integer,Integer> ();

			n = sc.nextInt();
			for(index=0;index<n;index++) {
				h = sc.nextInt();
				map.put(index,h);
				}
			sc.close();

			loop1: for(index=1;index<n;index++) {
				loop2: for(index2=0;index2<index;index2++) {
					if(map.get(index2)>map.get(index)) {
						result--;
						break loop2;
						}
					}
				result++;
				}			
			// 出力

			System.out.println(result);
	}
}

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

struct Point{
  double x, y;
};

void koch(int n, Point a, Point b){
  if (n == 0) return;
  Point s, t, u;

  double th = M_PI * 60.0 / 180.0;
  
  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n - 1, a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, b);
}

int main(){
  Point a, b;
  int n;
  scanf("%d", &n);
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);
  
}


Measured memory_bytes: 3184
#include<stdio.h>
int main()
{
    int n,c,i,count=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&c);
        if(c!=i)
        {
            count++;
        }
    }
    if(count==2||count==0)
    printf("YES\n");
    else
    printf("NO\n");
    return 0;
}

Measured memory_bytes: 1664
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=50;

int n;
int C[N+3];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&C[i]);
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			ans+=C[i]*C[j];
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int dir[] = { 0, 1, 0, -1 };
short H, W, a[1009][1009], dp[1009][1009][259]; bool used[1009][1009];
short solve(int x, int y) {
	if (x == H && y == W) return 0;
	int bit = used[x][y] + 2 * used[x - 1][y] + 4 * used[x][y - 1] + 8 * used[x - 1][y + 1] + 16 * used[x + 1][y - 1] + 32 * used[x - 1][y - 1] + 64 * used[x][y + 1] + 128 * used[x + 1][y];
	if (dp[x][y][bit] != 32767) return dp[x][y][bit];
	short ret = 32767;
	for (int i = 0; i < 2; i++) {
		int tx = x + dir[i], ty = y + dir[i ^ 1];
		if (tx <= H && ty <= W) {
			short val = 0, rbit = 0;
			if (!used[tx][ty]) val = a[tx][ty], used[tx][ty] = true, rbit = 16;
			for (int j = 0; j < 4; j++) {
				int ux = tx + dir[j], uy = ty + dir[j ^ 1];
				if (!used[ux][uy]) {
					used[ux][uy] = true;
					val += a[ux][uy];
					rbit |= 1 << j;
				}
			}
			for (int j = 0; j < 4; j++) {
				int ux = tx + dir[j], uy = ty + dir[j ^ 1];
				if (rbit & (1 << j)) val -= a[ux][uy], used[ux][uy] = false;
				ret = min(ret, (short)(val + solve(tx, ty)));
				if (rbit & (1 << j)) val += a[ux][uy], used[ux][uy] = true;
			}
			for (int j = 0; j < 4; j++) {
				if (rbit & (1 << j)) used[tx + dir[j]][ty + dir[j ^ 1]] = false;
			}
			if (rbit & 16) used[tx][ty] = false;
		}
	}
	return dp[x][y][bit] = ret;
}
char buf[1009];
int main() {
	scanf("%hd%hd", &H, &W);
	for (int i = 0; i < H; i++) {
		scanf("%s", buf);
		for (int j = 0; j < W; j++) {
			if (buf[j] != '.') a[i + 1][j + 1] = buf[j] - 48;
			fill(dp[i + 1][j + 1], dp[i + 1][j + 1] + 256, 32767);
		}
	}
	int ret = solve(1, 1);
	printf("%hd\n", ret);
	return 0;
}

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

int main() {
	vector<int> vec_1(4); vector<int> vec_2(2); int ans = 0;
	for (int i = 0; i < 4; i++) cin >> vec_1[i];
	sort(vec_1.begin(), vec_1.end(), greater<int>());
	for (int i = 0; i < 2; i++) cin >> vec_2[i];
	sort(vec_2.begin(), vec_2.end(), greater<int>());
	for (int i = 0; i < 3; i++) ans = ans + vec_1[i];
	for (int i = 0; i < 1; i++) ans = ans + vec_2[i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3124
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

int main() {
	int a, b;
	cin >> a >> b;

	cout << max(max(a + a - 1, b + b - 1), a + b) << endl;
}

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

int main(void){
  int h,w,i,j;
  char a[1000][1000];

  scanf("%d %d",&h,&w);

  for(i=0;i<h;i++)
    scanf("%s",a[i]);

  for(i=0;i<w+2;i++)
    printf("#");
  printf("\n");
  for(i=0;i<h;i++)
    printf("#%s#\n",a[i]);
  for(i=0;i<w+2;i++)
    printf("#");
  printf("\n");

  return 0;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll,int,int>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9 + 7;

int main(void){
  int n;
  cin >> n;
  auto v = vector<int>(n);
  for(int i = 0;i < n;++i){
    cin >> v[i];
  }
  int res = 0;
  for(int i = 0;i < n-2;++i){
    if(max(v[i],max(v[i+1],v[i+2])) != v[i+1] &&
       min(v[i],min(v[i+1],v[i+2])) != v[i+1]){
      ++res;
    }
  }
  cout << res << endl;
  return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int main() {
	int h = nxt(), w = nxt(), n = nxt();
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i) {
		a[i].first = nxt() - 1;
		a[i].second = nxt() - 1;
	}
	sort(all(a), [](const pair<int, int>& p, const pair<int, int>& q) {
		return p.second < q.second;
	});
	set<pair<int, int>> S;
	for (auto p : a) {
		S.insert(p);
	}

	int ans = h;
	int x = 0;
	int y = 0;
	for (auto p : a) {
		while (y < p.second) {
			++x;
			if (!S.count({x, y + 1})) {
				++y;
			}
		}
		if (x < p.first) {
			ans = min(ans, p.first);
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 11136
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
size = 4*10**5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, size + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n, k = map(int,input().split())

k = min(k, n-1)

ans = 0

for m in range(k+1):
    ans += cmb(n, m, mod) * cmb(n-1, n-m-1, mod)

ans %= mod

print(ans)

Measured memory_bytes: 50832
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,ans=0;
	cin>>n;
	vector<int>l(2*n);
	rep(i,2*n)cin>>l.at(i);
	sort(all(l));
	for(int i=0;i<2*n;i+=2)ans+=l.at(i);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
N, A, B = gets.chomp.split.map(&:to_i)

sum = 0
for i in 1..N do
  data = i / 10000 + i % 10000 / 1000 + i % 1000 / 100 + i % 100 / 10 + i % 10
  sum += i if data >= A && data <= B
end

puts sum

Measured memory_bytes: 1788
N = gets.to_i
data = gets.split(" ").map!{|i| i.to_i}
data.sort! {|x , y| y <=> x}
sum = 0 ; n = 2
for i in 0..N-1 do
  if n % 2 == 0
    sum = sum+data[i];
  else
    sum = sum-data[i];
  end
n = n+1
end
puts sum

Measured memory_bytes: 1788
import java.util.*;
class Main
{
    public  static int N, a, b, c;
    public static int[] l;
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        l = new int[N];
        for(int i = 0; i < N; i++){
            l[i] = sc.nextInt();
        }
        System.out.println(solve(0, 0, 0, 0));
    }
    static int solve(int n, int x, int y, int z){
        if(n == N){
            if(Math.min(x, Math.min(y, z)) > 0) return Math.abs(a - x) + Math.abs(b - y) + Math.abs(c - z) - 30;
            else return 10000000;
        }
        int res0,res1, res2, res3;
        res0 = solve(n + 1, x, y, z);
        res1 = solve(n + 1, x + l[n], y, z) + 10;
        res2 = solve(n + 1, x, y + l[n], z) + 10;
        res3 = solve(n + 1, x, y, z + l[n]) + 10;
        return Math.min(res0, Math.min(res1, Math.min(res2, res3)));
    }
}

Measured memory_bytes: 25556
#include <stdio.h>
int main(void){
  int th, ta, ah, aa;
  scanf("%d %d %d %d", &th, &ta, &ah, &aa);
  int turnt, turna;
  turnt = th / aa;
  if(th % aa != 0){
    turnt++;
  }
  turna = ah / ta;
    if(ah % ta != 0){
    turna++;
  }
  if(turna > turnt){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 1644
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,k; cin >> n >> k;
    set<ll> st;
    ll d;
    rep(i,k) {
        cin >> d;
        st.insert(d);
    }
    ll tmp;
    bool flag = false;
    while(1){
        tmp = n;
        while(1){
            if(st.find(tmp % 10) != st.end()){
                break;
            }
            tmp /= 10;
            if(tmp == 0){
                flag = true;
                break;
            }
        }
        if(flag) break;
        n++;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if x == 500*i+100*j+50*k :
        ans +=1
        
print(ans)


Measured memory_bytes: 3060
def solve(ar):
  n = len(ar)
  if sum(ar) % (n * (n+1) // 2) != 0:
    return False
  l = sum(ar) // (n * (n+1) // 2)
  ar2 = []
  for i in range(n-1):
    if i == 0:
      ar2.append(ar[0])
    else:
      ar2.append(ar[i] - ar[i-1] - l)

  b = [0]
  for i in range(1, n-1):
    if ar2[i] % n != 0:
      return False
    bi = - ar2[i] // n
    if bi < 0:
      return False
    b.append(bi)

  a = ar[0]
  a2 = l
  for i in range(1, n-1):
    a -= b[i] * (n-i+1)
    a2 -= b[i]

  bn = a - a2
  b0 = a2 - bn
  if bn < 0 or b0 < 0:
    return False

  return True

n = int(input())
ar = [int(x) for x in input().split()]
if solve(ar):
  print("YES")
else:
  print("NO")





Measured memory_bytes: 14720
#include<stdio.h>
int n, m, ans, a, mp[55][55], v[55];
int main() {
    int i, x, y, f = 1;
    scanf("%d%d", &n, &m);
    for(i = 1; i <= m; ++i) {
        scanf("%d%d", &x, &y);
        ++v[x];
        ++v[y];
        mp[x][y] = mp[y][x] = 1;
    }
    while(1) {
        f = 1;
        for(i = 1; i <= n; ++i) {
            if(v[i] == 1){
                ++ans;
                a = i;
                f = 0;
                --v[i];
                break;
            }
        }
        if(f) break;
        for(i = 1; i <= n; ++i) {
            if(mp[a][i] == 1)
                --v[i];
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dp;
string s,t;
int solve(int i, int j){
    if(i < 0 || j < 0) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    if(s[i] == t[j]){
        dp[i][j] = 1 + solve(i-1,j-1);
        return 1 + solve(i-1,j-1);
    }
    int ret = max(solve(i-1,j) , solve(i,j-1));
    dp[i][j] = ret;
    return ret;
}

string gotSolution(int i, int j){
    if(i < 0 || j < 0) return "";
    if(s[i] == t[j]) return (s[i] + gotSolution(i-1,j-1));
    if(solve(i-1,j) > solve(i,j-1)) return gotSolution(i-1,j);
    else return gotSolution(i,j-1);
}

int main(){
    //string s,t;
    cin >> s >> t;
    dp.resize(s.size());
    for(int i = 0 ; i < s.size() ; i++){
        dp[i].resize(t.size(),-1);
    }
    solve(s.size() - 1 , t.size() - 1);
    string str = gotSolution(s.size() - 1 , t.size() - 1);
    reverse(str.begin(),str.end());
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 36096
#include<cstdio>
#include<iostream>
using namespace std;
int a[100010];
int n;
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
bool dg()
{
	long long sum=0;
	bool ex=0;
	int num=0;
	for (int i=1;i<=n;i++)
	{
		sum+=a[i]-1;
		if (a[i]==1) ex=1;
		if (a[i]&1) num++;
	}
	if (ex) return sum%2;
	if ((n-num)%2) return 1;
	if (num==1)
	{
		int g=0;
		for (int i=1;i<=n;i++)
			if (a[i]&1) a[i]--;
		for (int i=1;i<=n;i++)
			g=gcd(g,a[i]);
		for (int i=1;i<=n;i++)
			a[i]/=g;
		return dg()^1;
	}
	return 0;
		
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	if (dg()) printf("First");
		else printf("Second");
}

Measured memory_bytes: 640
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package here;

/**
 *
 * @author sokumar
 */
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = sc.nextInt();
        int []h = new int[n+1];
        for(int i=1;i<=n;i++)
        {
            h[i] = sc.nextInt();
        }
        int []c = new int[n+1];
        c[1] = h[1];
        //c[2] = h[2];
        c[2] = Math.abs(h[2]-h[1]);
        
        for(int i=3;i<=n;i++)
        {
           if(i!=3)
           {
           int r1 = c[i-2]+Math.abs(h[i]-h[i-2]);
           int r2 = c[i-1]+Math.abs(h[i]-h[i-1]);
           c[i] = Math.min(r1, r2);
           }
           else
           {
               int r1 = Math.abs(h[i]-h[i-2]);
           int r2 =c[2]+Math.abs(h[i]-h[i-1]);
           c[i] = Math.min(r1, r2);
               
           }
          //w.print(c[i] + " ");
        }
        w.println(c[n]);
        
        w.close();
    }
    
}


Measured memory_bytes: 51000
#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>;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long 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(long long 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;
    }
    mint choose(int n, int a){
        mint x = 1 ,y = 1;
        for(int i=0; i<a; ++i){
            x *= n-i;
            y *= i+1;
        }
        return x / y;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main(){
    int n,k;
    cin>>n>>k;
    for(int i=1; i<=k; ++i){
        mint ans=mint().choose(n-k+1,i)*mint().choose(k-1,i-1);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

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

  set<char> Set;
  for (char c : N) {
    Set.insert(c);
  }

  if (Set.size() == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

const int inf = 99999999;

#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
vector<int> lis_fast(const vector<int>& a) {
  const int n = a.size();
  vector<int> A(n, inf);
  vector<int> id(n);
  for (int i = 0; i < n; ++i) {
    id[i] = index_of(A, a[i]);
    A[ id[i] ] = a[i];
  }
  return id;
}

vector<int> id;
vector<int> a;
vector<int> b[100005];

long long  dp[100005];
long long dfs(int idx){
  if(dp[idx] != -1){
    return dp[idx];
  }
  if(id[idx] == 0){
    return a[idx];
  }
  long long  ret = 0;
  int tmp = 0;
  // for(int i=idx-1;i>=0;i--){
  for(int j=b[id[idx] - 1].size()-1;j>=0;j--){
    int i = b[id[idx] - 1][j];
    if(id[idx] - 1 == id[i] && a[i] < a[idx] && tmp < a[i] ){
      ret = max(ret, dfs(i));
      tmp = a[i];
    }
  }
  dp[idx] = ret + a[idx];
  return dp[idx];
}

int main(){
  int N;
  cin >> N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  a = A;
  id = lis_fast(A);
  for(int i=0;i<N;i++){
    b[id[i]].push_back(i);
  }
  memset(dp, -1, sizeof(dp));
  int m = *max_element(id.begin(), id.end());
  long long res = 0;
  for(int i=b[m].size()-1;i>=0;i--){
  // for(int i=N-1;i>=0;i--){
    if(id[b[m][i]] == m) res = max(res, dfs(b[m][i]));
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 16488
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
As = []
for _ in range(N):
    As += list(map(int, input().split()))[1:]

ans = 0
for i in range(1, M + 1):
    ans += 1 if sum([1 for A in As if A == i]) == N else 0

print(ans)


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


vector<vector<int>> g;
vector<int> dep, in, out, res;

void eur(int cur, int pre, int& idx) {
    in[cur] = idx++;
    for (auto nxt : g[cur]) {
        if (nxt == pre) continue;
        eur(nxt, cur, idx);
    }
    out[cur] = idx;
}
void dfs_dep(int cur, int pre) {
    if (pre != -1) dep[cur] = dep[pre] + 1;
    for (auto nxt : g[cur]) {
        if (nxt == pre) continue;
        dfs_dep(nxt, cur);
    }
}

void bfs(vector<int>& st) {
    queue<int> q;
    for (auto e : st) q.emplace(e), res[e] = e;
    while (!q.empty()) {
        int cur= q.front();
        q.pop();
        for (auto nxt : g[cur]) {
            if (dep[cur] < dep[nxt]) {
                if (dep[res[nxt]] < dep[res[cur]]) {
                    res[nxt] = res[cur];
                    q.emplace(nxt);
                }
            }
        }
    }
}

void init(int n) {
    g.clear(); dep.clear(); in.clear(); out.clear(); res.clear();
    g.resize(n); dep.resize(n), in.resize(n), out.resize(n), res.resize(n);
}

void solve() {
    int n, kkt; cin >> n >> kkt; if (n == 0) exit(0);
    init(n);
    for (int i = 1; i < n; i++) {
        int p; cin >> p; p--;
        g[p].emplace_back(i);
        g[i].emplace_back(p);
    }
    {
        int idx = 0;
        eur(0, -1, idx);
        dfs_dep(0, -1);
    }

    int b = sqrt(n);
    vector<int> t;
    ll r = 0;
    while (kkt--) {
        char c;
        int v;
        cin >> c >> v; v--;
        if (c == 'Q') {
            int ans = res[v];
            for (auto e : t) {
                if (in[e] <= in[v] and in[v] < out[e]) {
                    if (ans == -1 or dep[ans] < dep[e]) {
                        ans = e;
                    }
                }
            }
            r += ans + 1;
        }
        else {
            t.emplace_back(v);
        }
        if (t.size() >= b) {
            bfs(t);
            t.clear();
        }
    }
    cout << r << "\n";
}
int main()
{
    
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    

    int kkt = 89;
    while (kkt) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 17092
n, m = [0] * 2
a = []

def format_input(filename = None):
	global n, m
	global a
	if filename == None:
		n, m = list(map(int, input().split()))
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 10**2)
		m = rng(1, n)
		a = [rng(1, 10**3) for i in range(n)]
		print(n, m)
		print(' '.join(list(map(str, a))))

def get_answer():
	sorted_a = sorted(a)
	if sorted_a[-m] > (sum(a) - 1) // (4 * m):
		answer = 'Yes'
	else:
		answer = 'No'
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define mx 200005
#define mod 1000000007
#define mxm 999999999999
using namespace std;

ll dp[200][mx];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    
    ll n,p,w[200],v[200],i,j;
    cin>>n>>p;
    for(i=1;i<n+1;i++)
    cin>>w[i]>>v[i];
    for(i=1;i<n+1;i++)
    {
        for(j=1;j<p+1;j++)
        {
            if(j<w[i])
            dp[i][j]=dp[i-1][j];
            else
            dp[i][j]=max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
        }
    }
    ll ans=dp[n][p];
    cout<<ans;
	return 0;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  for(int i = 0; i < h; i++) cin >> grid.at(i);
  
  vector<vector<int>> dp(h, vector<int> (w, 100000));
  if(grid.at(0).at(0) == '#') dp.at(0).at(0) = 1;
  else dp.at(0).at(0) = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      int score = dp.at(i).at(j), down, right;
      char c = grid.at(i).at(j);
      if(i+1 < h) down = dp.at(i+1).at(j);
      if(j+1 < w) right = dp.at(i).at(j+1);
      if(c == '#'){
        if(i+1 < h) dp.at(i+1).at(j) = min(down, score);
        if(j+1 < w) dp.at(i).at(j+1) = min(right, score);
        continue;
      }
      if(i+1 < h){
        if(grid.at(i+1).at(j) == '#') dp.at(i+1).at(j) = min(down,score + 1);
        else dp.at(i+1).at(j) = min(down, score);
      }
      if(j+1 < w){
        if(grid.at(i).at(j+1) == '#') dp.at(i).at(j+1) = min(right, score + 1);
        else dp.at(i).at(j+1) = min(right, score);
      }
    }
  }
  
  cout << dp.at(h-1).at(w-1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N, D, X;
  cin >> N >> D >> X;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  int ans = 0;
  for (int day = 1; day <= D; day++) {
    REP(i, N) {
      int j = 0;
      while (j * A[i] < 101) {
        if (1 + j * A[i] == day) {
          ans++;
          break;
        }
        j++;
      }
    }
  }
  ans += X;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct edge {
    int to,rev;
    int cap;
    edge(int to,int cap,int rev):to(to),cap(cap),rev(rev) {}
};

struct Dinic{
    int N;
    vector<vector<edge>> G;
    vector<int> level; // min distance from s
    vector<int> iter;

    Dinic(int _N):N(_N) {
        G.resize(N),level.resize(N), iter.resize(N);
    }

    void add_edge(int a,int b,int c){
        // only directed edge
        G[a].push_back((edge){b,c,(int)G[b].size()});
        G[b].push_back((edge){a,0,(int)G[a].size() - 1});
    }

    void _bfs(int s){
        fill(level.begin(),level.end(),-1);
        queue<int> q;
        q.push(s);
        level[s] = 0;
        while (!q.empty()){
            int v = q.front(); q.pop();
            for (int i = 0;i < G[v].size(); ++i){
                edge &e = G[v][i];
                if (e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    q.push(e.to);
                }
            }
        }
    }
    
    int _dfs(int v,int t,int f){
        if (v == t) return f;
        for (int &i = iter[v];i < G[v].size(); ++i) {
            edge &e = G[v][i];
            if (e.cap > 0 && level[e.to] > level[v]){
                int d = _dfs(e.to,t,min(f,e.cap));
                if (d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    int maxflow(int s,int t){
        int flow = 0;
        for (;;){
            _bfs(s);
            if (level[t] < 0) return flow; // no augmenting path
            fill(iter.begin(),iter.end(),0);
            int f;
            while ((f = _dfs(s,t,INF)) > 0) flow += f;
        }
    }
};

int main() {
    int N; cin >> N;
    Dinic dn(2*N + 2);
    rep(i,N) dn.add_edge(0,i + 1,1);
    rep(i,N) dn.add_edge(N + i + 1,2*N + 1,1);
    vector<P> A(N),B(N);
    rep(i,N) {
        int a,b; cin >> a >> b;
        A[i] = make_pair(a,b);
    }
    rep(i,N) {
        int a,b; cin >> a >> b;
        B[i] = make_pair(a,b);
    }
    rep(i,N)rep(j,N) {
        if (A[i].first < B[j].first && A[i].second < B[j].second) dn.add_edge(i + 1,N + j + 1,1);
    }
    cout << dn.maxflow(0,2*N + 1) << '\n';
}

Measured memory_bytes: 3700
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int s = max(a, max(b, c));
    int t = min(a, min(b, c));
    int ans = s - t;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
 
 
using namespace std;
 
int main()
{
	int A,B,C;
	cin >> A >> B ; 
 
	C = A + B;
	if (C >= 24) C = C - 24;
 
	cout << C << endl;
    
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

    int n;
    cin>>n;
    string s[n];
    rep(i,n)cin>>s[i];
    map<string,int> mp;
    rep(i,n){
        mp[s[i]]++;
    }
    
    cout<<mp.size()<<endl;

    
    return 0;
}


Measured memory_bytes: 25372
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
ct=0
a=f(n)
for i in range(len(a)):
    ct2=0
    ct3=1
    c=a[i][1]
    while 1:
        ct2+=ct3
        if ct2==c:
            ct+=ct3

            break
        elif ct2>c:
            ct+=ct3-1
            break
        ct3+=1
if n==1:
    ct=0
print(ct)

Measured memory_bytes: 63416
#include <iostream>
    
    using namespace std;
    typedef long long int ll;
    
    ll p =1e9+7;
    int main() {
        int n;cin>>n;
        ll a[n] ;for (int i=0;i<n;++i)cin>>a[i];
        ll pref[n];pref[0]=a[0];
        
        for (int i=1;i<n;++i)pref[i]=(a[i]+pref[i-1])%p;
        
        ll ans = 0 ,sum = pref[n-1];
        for (int i=0;i<n-1;++i){
            ans = (ans + a[i] * (sum - pref[i]+p))%p;
        }
        cout<<ans;
        
    }

Measured memory_bytes: 6736
#include<bits/stdc++.h>
#define PI 3.1415926535
#define N 10010
using namespace std;
int n, m;
int a, b, c;
int d[N];
int x ,y, w, h, r;
int p = 1;
int cnt = 0;

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &d[i]);
    }
    for(int i = n-1; i >= 0; i--){
        printf("%d", d[i]);
        if(i) printf(" ");
        else printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define LL_MAX LLONG_MAX
#define ULL_MAX ULLONG_MAX
#define ull unsigned long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define mk make_pair
#define endl '\n'

int main()
{
    IOS;
    string s;
    cin>>s;
    if(s=="ARC")
    {
        cout<<"ABC";
    }
    else
    {
        cout<<"ARC";
    }
    
}

Measured memory_bytes: 3612
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#include <bits/stdc++.h>
#endif

using namespace std;

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

    if (s.length() <= k)
        cout << s;
    else
        cout << s.substr(0, k) << "...";

    return 0;
}


Measured memory_bytes: 3596
n=int(input())
info=sorted([list(map(int,input().split())) for _ in range(n)],key=lambda x:-x[2])
x0,y0,h0=info[0][0],info[0][1],info[0][2]

for i in range(101):
  for j in range(101):
    f=1
    hp=h0+abs(i-x0)+abs(j-y0)
    for k in range(n):
      x,y,h=info[k][0],info[k][1],info[k][2]
      if h>0:
        if h+abs(i-x)+abs(j-y)==hp:
          continue
        else:
          f=0
          break
      else:
        if hp-abs(i-x)-abs(j-y)<=0:
          continue
        else:
          f=0
          break
    if f==1:print(i,j,hp,sep=" ")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;

void abc_150a();

void abc_151a();

void abc_152a();

void abc_154a();

void abc_156a();

void abc_157a();

void abc_158a();

int main()
{
  //abc_150a();
  //abc_151a();
  //abc_152a();
  //abc_154a();
  //abc_156a();
  //abc_157a();
  abc_158a();

}

void abc_150a()
{
  int K, X;
  cin >> K >> X;

  if (500 * K >= X) cout << "Yes\n";
  else cout << "No\n";
}

void abc_151a()
{
  char C;
  cin >> C;

  cout << (char)((int)C + 1) << "\n";
}

void abc_152a()
{
  int N, M;
  cin >> N >> M;
  if (N == M) cout << "Yes\n";
  else cout << "No\n";
}

void abc_154a()
{
  string S, T;
  cin >> S >> T;
  int a, b;
  cin >> a >> b;
  string U;
  cin >> U;

  if (S == U) cout << a - 1 << " " << b << "\n";
  else cout << a << " " << b - 1 << "\n";

}


void abc_156a()
{
  int N, R;
  cin >> N >> R;

  if (N >= 10) cout << R << "\n";
  else cout << R + 100 * (10 - N) << "\n";
}

void abc_157a()
{
  int N;
  cin >> N;

  if (N % 2 == 0) cout << N / 2 << "\n";
  else cout << N / 2 + 1 << "\n";
}

void abc_158a()
{
  vector<char> s(3);
  for (int i = 0; i < 3; ++i) cin >> s[i];
  for (int i = 0; i < 3; ++i)
  {
    for (int j = i + 1; j < 3; ++j)
    {
      if (s[i] != s[j])
      {
        cout << "Yes\n";
        return;
      }
    }
  }
  cout << "No\n";

}

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

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

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

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

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

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

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

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

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

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

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

signed solve()
{
	int n;
	cin >> n;
	map<int, int> mp;
	REP(i, n)
	{
		int a;
		cin >> a;
		int div_a = a / 400;
		if (div_a >= 8)
			div_a = 8;
		mp[div_a]++;
	}
	if (mp.count(8) == 0)
	{
		print(SIZE(mp), SIZE(mp));
	}
	else
	{
		if (SIZE(mp) == 1)
			print(1, mp[8]);
		else
			print(SIZE(mp) - 1, SIZE(mp) - 1 + mp[8]);
	}
	return 0;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static Scanner sc;

    public Main() {
    }

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

    }

    private void solve() {
        int R = sc.nextInt();
        int G = sc.nextInt();
        System.out.println(G + -(R - G));
    }
}


Measured memory_bytes: 22356
// *_*
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readarr(a, n) int a[(n) + 1] = {}; fori(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori(i, 1, n) {fori(j, 1, m) cin >> a[i][j];}
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for(int i = a; i <= b; i++)
#define ford(i, a, b) for(int i = a; i >= b; i--)
#define sort1(v) sort(v.begin(), v.end()) 
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;

const long long inf2 = (long long)1e18;
const long long mod = (long long)(1e9+7);
const long long inf1 =(long long)(1e6+1);
vi vec;

void prime_factor(int n)
{
	if(n%2 == 0)
	{
		vec.pb(2);
		while(n%2 == 0) n = n/2;
	}

		for(int i = 3; i*i <= n; i += 2)
		{
			if(n%i == 0)
			{
				vec.pb(i);
				while(n%i == 0) n = n/i;
			}
		}

		if(n > 2) vec.pb(n);
}

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

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

	int g = __gcd(a, b);

	prime_factor(g);

	cout << vec.size() + 1;

	return 0;
}

Measured memory_bytes: 256