akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
int main(){
	
	string s; cin>>s;
	int n = s.size();
	vector<vector<ll>> sum(n+1,vector<ll>(13));
	int k{};
	sum.at(0).at(0) = 1;
	for(auto i:s){
		k++;
		if('0'<=i && i<='9'){
			for(int j=0; j<13; j++){
				( sum.at(k).at((j*10+i-'0')%13) += sum.at(k-1).at(j) ) %=MOD;
			}
			
		}
		else {
			for(int l=0; l<10; l++){
				for(int j=0; j<13; j++){
					( sum.at(k).at((j*10+l)%13) += sum.at(k-1).at(j) ) %=MOD;
				}
			}
		}
	}
	cout << sum.at(n).at(5) << endl;
	
}


Measured memory_bytes: 13696
#include <stdio.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define mi(x,y) ((x)<(y)?(x):(y))
int main() {
	int n, alp[26], alpc[26] = { 0 };
	char c[51] = { '\0' };
	rep(i, 26)alp[i] = 51;
	scanf("%d", &n);
	rep(i, n) {
		scanf("%s", c);
		rep(j, strlen(c))alpc[c[j] - 97]++;
		rep(j, 26) {alp[j] = mi(alp[j], alpc[j]); alpc[j] = 0;}
	}
	rep(i, 26)rep(j, alp[i])printf("%c", i + 97);
	return 0;
}

Measured memory_bytes: 128
from collections import OrderedDict, deque, Counter

def solve():
    N, K = list(map(int, input().split(" ")))
    A = list(map(int, input().split(" ")))
    counter = Counter(A)
    target = counter.most_common()
    l = len(target) - K
    target.reverse()
    ans = target[:l]
    summation = 0
    for word, cnt in ans:
        summation += cnt

    print(summation)


solve()

Measured memory_bytes: 39344
N, Q = map(int, input().split())
S = input()
cumulative = [0] * (N+1)
for i in range(N-1):
  if S[i:i+2] == "AC":
    cumulative[i+2] = cumulative[i+1] + 1
  else:
    cumulative[i+2] = cumulative[i+1]
    
for _ in range(Q):
  start, end = map(int, input().split())
  ans = cumulative[end] - cumulative[start-1]
  if start > 1 and S[start-2:start] == "AC":
    ans -= 1
  print(ans)

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX = 505;

int N, K;
int A[MAX];

vi getFactors(int x) {
    vi factors;
    for (int k = 1; k*k <= x; k++) {
        if (x%k == 0) {
            factors.PB(k);
            if (k*k != x) factors.PB(x/k);
        }
    }
    sort(ALL(factors));
    return factors;
}

bool judge(vi nums, int f) {
    int k = K;
    int c = 0;
    for (; c < N; c++) {
        k -= nums[c];
        if (k == 0) c++;
        if (k <= 0) break;
    }
    k = K;
    for (; c < N; c++) {
        k -= f-nums[c];
        if (k < 0) return false;
    }
    return true;
}

int solve() {
    int sum = 0;
    REP (i, N) sum += A[i];
    vi factors = getFactors(sum);
    REPR (i, factors.size()) {
        int fact = factors[i];
        vi a;
        REP (i, N) a.PB(A[i]%fact);
        sort(ALL(a));
        if (judge(a, fact)) {
            return fact;
        }
    }
    return 1;
}

int main() {
    cin >> N >> K;
    REP (i, N) cin >> A[i];
    cout << solve() << endl;
}

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

int main(){
  ll N,A,B;
  cin >> N >> A >> B;
  ll AB = A + B;
  
  ll counter = 0;
  counter = N/AB;
  N %=AB;
  
  if(N < A){
    cout << counter*A + N << endl; 
  }else{
    cout << (counter+1)*A << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int a,b,k;
	cin >> a >> b >> k;
	for(int i=100;i>=1;i--)
	{
		if(a%i==0&&b%i==0)
		{
			--k;
		}
		if(k==0)
		{
			cout << i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
N,X=input().split()
N,X=int(N),int(X)

L1=input().split()
L2=[]
for i in L1:
    L2.append(int(i))

c=1
d=0
for i in range(N):
    d+=L2[i]
    if d<=X:
        c+=1
    else:
        break

print(c)


Measured memory_bytes: 3060
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000003
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
const long long INFll=1ll*INF*INF;
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug(x) cout << x << endl;
#define sz(a) int((a).size())
int mul(int a, int b,int mod = MOD) {
	return int(a * 1ll * b % mod);
}
int norm(int a,int mod = MOD) {
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
	//a = (a%mod+mod)%mod;
	return a;
}
int powmod(int x,int y,int mod = MOD){
	int res = 1;
	while(y>0)
	{
		if(y&1)
			res = mul(res,x,mod);
		x = mul(x,x,mod);
		y=y>>1;
	}
	return res;
}
int inv(int a,int mod = MOD) {
	return powmod(a, mod - 2);
}	

int main() {

	// #ifndef ONLINE_JUDGE
	// freopen("E:\\Codes\\in.txt", "r", stdin);
	// freopen("E:\\Codes\\out.txt", "w", stdout);
	// #endif
	int n;
	cin>>n;
	vector<int> h(n+1),dp(n+1);
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
	}	
	dp[2] = abs(h[1] - h[2]);
	dp[1] = 0;
	
	for(int i=3;i<=n;i++)
	{
		dp[i] = min(dp[i-1]+abs(h[i] - h[i-1]),dp[i-2]+abs(h[i] - h[i-2]));
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1152
use std::io;

fn main() {
    let ints = read_ints();
    let (n, m, x) = (ints[0] as usize, ints[1] as usize, ints[2]);

    let mut c: Vec<i32> = Vec::new();
    let mut a: Vec<Vec<i32>> = Vec::new();
    for _ in 0..n {
        let ints = read_ints();
        c.push(ints[0]);
        a.push(Vec::from(&ints[1..]));
    }

    let mut skills = vec![SkillSet::default()];
    skills[0].level = vec![0; m];

    for i in 0..n {
        let mut tmp = Vec::new();
        for s in &skills {
            let mut s = s.clone();
            s.cost += c[i];
            for j in 0..m {
                s.level[j] += a[i][j];
            }
            tmp.push(s);
        }
        skills.append(&mut tmp);
    }

    let mut min_cost = -1i32;
    for s in &skills {
        if s.level.iter().all(|&l| l >= x) &&
           (min_cost < 0 || s.cost <= min_cost) {
            min_cost = s.cost;
        }
    }

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

fn read_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn read_ints() -> Vec<i32> {
    read_line()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

#[derive(Default, Clone)]
struct SkillSet {
    cost: i32,
    level: Vec<i32>,
}


Measured memory_bytes: 2516
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
void solve(){
  int n;
  cin>>n;
  int a,b,maxv=0;
  int rest=0;
  rep(i,n){
    cin>>a>>b;
    if(chmax(maxv,a))rest=b;
  }
  cout<<maxv+rest<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()

    dp = [0] * (N + 1)
    ans = 0

    for i in range(N - 1, -1, -1):
        for j in range(i + 1, N):
            if S[i] == S[j]:
                dp[j] = dp[j + 1] + 1
                if ans < min(dp[j], j - i):
                    ans = min(dp[j], j - i)
            else:
                dp[j] = 0

    print(ans)
    return


if __name__ == '__main__':
    main()


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

#ifdef ONLINE_JUDGE
#define freopen \
  if (0) freopen
#define cerr \
  if (0) cerr
#endif

#define fi first
#define se second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)

#define sqr(a) ((a)*1ll * (a))
#define sz(a) (int)a.size()
#define len(a) (int)a.length()
#define all(a) a.begin(), a.end()
#define nl '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pi;

const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

int n;
string s;
int dp[5005][10010];

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

  dp[0][0] = 1;
  rep(i, 1, n) {
    rep(j, 0, 10005) {
      int tmp = j > 0 ? dp[i - 1][j - 1] : dp[i - 1][j];
      dp[i][j] += (tmp + 2 * 1ll * dp[i - 1][j + 1]) % mod;
      dp[i][j] %= mod;
    }
  }

  cout << dp[n][len(s)];
}

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

  freopen(".in", "r", stdin);

  solve();

  return 0;
}

Measured memory_bytes: 199136
import sys
input = sys.stdin.readline

N,K=map(int,input().split())
h = list(map(int, input().split()))
INF = N*1e+4
dp = [INF]*N
dp[0]=0
for i in range(1,N):
    for j in range(1,K+1):
        if i-j<0: break
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[N-1])


Measured memory_bytes: 54876
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
G = []
E = []

class UnionFind:
	def __init__(self, n):
		self.rank = [0] * n
		self.parent = [0] * n
		self.make(n)

	def make(self, n):
		for i in range(n):
			self.parent[i] = i

	def unite(self, x, y):
		xroot = self.findset(x)
		yroot = self.findset(y)
		if self.rank[xroot] < self.rank[yroot]:
			self.parent[xroot] = yroot
		elif self.rank[xroot] > self.rank[yroot]:
			self.parent[yroot] = xroot
		else:
			self.parent[xroot] = yroot
			self.rank[yroot] += 1
			node = y
			while True:
				self.rank[node] += 1
				if self.parent[node] == node:
					break
				node = self.parent[node]
			self.rank[y] += 1

	def findset(self, x):
		if self.parent[x] == x:
			return x
		else:
			root = self.findset(self.parent[x])
			self.parent[x] = root
			return root

class Edge:
    def __init__(self, fr, to, w):
        self.fr = fr
        self.to = to
        self.w = w

def kruskal(v, e):
    global E
    E.sort(key=lambda x: x.w)
    uf = UnionFind(v)
    mst = []
    for i in range(e):
        if uf.findset(E[i].fr) != uf.findset(E[i].to):
            uf.unite(E[i].fr, E[i].to)
            mst.append(E[i])
    return mst


def main():
    global G, E
    n, e = map(int, input().strip().split())
    G = [[] for _ in range(n)]
    E = [0] * e
    for i in range(e):
        s, t, w = map(int, input().strip().split())
        E[i] = Edge(s, t, w)
    mst = kruskal(n, e)
    # print(mst)
    # from functools import reduce
    # print(reduce(lambda x, y: x.w + y.w, mst))
    ans = 0
    for q in mst:
        ans += q.w

    print(ans)

if __name__ == '__main__':
    main()



Measured memory_bytes: 34504
# https://atcoder.jp/contests/abc063/tasks/arc075_a

n = gets.to_i
nums = []
n.times { nums << gets.to_i }

sum = nums.inject(:+)

if sum % 10 == 0
  balancer = nums.sort.find { |i| i % 10 != 0 }
  puts balancer.nil? ? 0 : sum - balancer
else
  puts sum
end


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;

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

	vector<long long int> A(N + 1);
	vector<long long int> B(N);
	for (int i = 0; i < N + 1; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	int j = 0;
	long long int sum = 0;
	while (j < N + 1) {
		if (A[j] > 0) {
			if (j > 0 && j < N) {
				sum += min(A[j], B[j - 1]);
				A[j] -= min(A[j], B[j - 1]);
				sum += min(A[j], B[j]);
				B[j] -= min(A[j], B[j]);
			}
			else if(j == N){
				sum += min(A[j], B[j - 1]);
			}
			else {
				sum += min(A[j], B[j]);
				B[j] -= min(A[j], B[j]);
			}
		}
		j++;
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)

static uint32_t getSN(uint32_t SN) {
	uint32_t sum = 0;

	while (SN > 0) {
		sum += SN % 10;

		SN /= 10;
	}

	return sum;
}

int main(void) {
	uint32_t N;

	scanf("%"PRIu32, &N);

	const uint32_t SN = getSN(N);

	printf("%s", N % SN == 0 ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#include<string.h>

#define FR(N) for(int i = 0;i < N;i++)
#define PR(N) printf("%d\n",N)
#define MJ(S) printf("%s\n",S)

int min(int a,int b){
  if(a < b)return a;
  return b;
}
int max(int a,int b){
  if(a > b)return a;
  return b;
}
int z(int a){
  if(a < 0)return -a;
  return a;
}
int yu(int a,int b){
  if(a < b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  int r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
void swap(int *x,int *y) {
  int temp = *x;
  *x = *y;
  *y = temp;
}
int partition(int array[],int left,int right) {
  int i,j,pivot;
  i = left;
  j = right + 1;
  pivot = left;
  do{
    do{i++;}while(array[i] < array[pivot]);
    do{j--;}while(array[pivot] < array[j]);
    if(i < j)swap(&array[i],&array[j]);
  }while(i < j);
  swap(&array[pivot],&array[j]);
  return j;
}
void q_sort(int array[],int left,int right) {
  int pivot;
  if(left < right){
    pivot = partition(array,left,right);
    q_sort(array,left,pivot - 1);
    q_sort(array,pivot + 1,right);
  }
}

int main(void){
  char s[20];
  scanf("%s",&s);
  int l = strlen(s),cnt = 0;
  FR(l){
    if(s[i] == 'x')cnt++;
  }
  if(cnt > 7){
    MJ("NO");
  }else{
    MJ("YES");
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

void Output(int sum){


	switch(sum%7){

	case 0:
		puts("Wednesday");
		break;

	case 1:
		puts("Thursday");
		break;

	case 2:
		puts("Friday");
		break;

	case 3:
		puts("Saturday");
		break;

	case 4:
		puts("Sunday");
		break;

	case 5:
		puts("Monday");
		break;

	case 6:
		puts("Tuesday");
		break;

	}
}

int main(void){

	int month,day;
	int kazu[11] = {31,29,31,30,31,30,31,31,30,31,30};
	int sum;
	int i;
	

	while(scanf("%d %d",&month,&day)!=EOF){
		
		if(month == 0 || day == 0)
			break;

		sum = 0;

		for(i=0;i<month-1;i++)
			sum += kazu[i];
		sum += day;

		Output(sum);

	}

	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<float.h>
#include<cfloat>
#include<string>
#include<ctype.h>
#include<algorithm>
#include<errno.h>
#include<cerrno>
#include<assert.h>
#include<cassert> 
#include<map>
#include<memory.h>
#include<cctype>
#include<ctype.h>
#include<math.h>
#include<vector> 
#include<cstdio> 
#include<set>
#include<string.h>
#include<stdio.h>
#include<new>
#include<memory>
#include<cmath>
#include<queue>
#include<cstring>
#define ll long long
#define fo(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define br break
#define ct continue
#define pb push_back
#define pi 3.141592653589793238462643383279502884197169
#define F first
#define S second
#define em empty()
#define vei vector<int>
#define ves vector<string>
#define qui queue<int> 
#define qu queue
using namespace std;
int main()
{int a,b,c;
 cin>>a>>b>>c;
 cout<<max(a,max(b,c))-min(a,min(b,c))<<endl;
 system("pause");
 return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int mod2 = 998244353;

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

Measured memory_bytes: 256
A = list(map(int, input().split()))
s_1 = ''
if (int(A[0]) < 0) and (int(A[2]) < 0):
  a = abs(int(A[0])) - abs(int(A[2]))
elif (int(A[0]) < 0) and (int(A[2]) > 0):
  a = abs(int(A[0])) + abs(int(A[2]))
else:
  a = int(A[2]) -  int(A[0])
  
if (int(A[1]) < 0) and (int(A[3]) < 0):
  b = abs(int(A[1])) - abs(int(A[3]))
elif (int(A[1]) < 0) and (int(A[3]) > 0):
  b = abs(int(A[1])) + abs(int(A[3]))
else:
  b = int(A[3]) -  int(A[1])

for i in range(b):
  s_1 = s_1 + 'U'
for i in range(a):
  s_1 = s_1 + 'R'
  
for i in range(b):
  s_1 = s_1 + 'D'
for i in range(a):
  s_1 = s_1 + 'L'
  
s_1 = s_1 + 'L'
for i in range(b+1):
  s_1 = s_1 + 'U'
for i in range(a+1):
  s_1 = s_1 + 'R'
s_1 = s_1 + 'D'
  
s_1 = s_1 + 'R'
for i in range(b+1):
  s_1 = s_1 + 'D'
for i in range(a+1):
  s_1 = s_1 + 'L'
s_1 = s_1 + 'U'
print(s_1)
  

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

struct modular_arithmetic{
	int mod;

	modular_arithmetic(){
		mod = 1000000007;
	}
	//No specific settings.
	int add(int x,int y){return (x+=y)<mod?x:x-mod;}
	int sub(int x,int y){return (x-=y)>=0?x:x+mod;}
	int mul(int x,int y){return (int)((long long int)x*y%mod);}
	int pw(int base, int p) {
		int res = 1, mu = base%mod;
		for(;p>0;p/=2) {
			if (p&1) res = mul(res, mu);
			mu = mul(mu, mu);
		}
		return res;
	}
	int rev(int x) {return pw(x, mod-2);}
};
modular_arithmetic ma;

int main() {
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	
	int ans = ma.pw(2, n);
	ans = ma.sub(ans, 1);
	
	int c = 1;
	for(int i=1;i<=b;i++) {
		c=ma.mul(c, n-i+1);
		c=ma.mul(c, ma.rev(i));
		if(i==a || i==b) ans = ma.sub(ans, c);
	}
	printf("%d\n", ans);
	
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np
H,W = map(int,input().split())
table = [["."]*(W+2),]
for _ in range(H):
    table.append([".",]+list(input())+[".",])
table.append(["."]*(W+2))
table = np.array(table)
ans = []
#print(table)
for h in range(H):
    for w in range(W):
        mawari = table[h:h+3,w:w+3]
        #print(mawari)
        if mawari[1,1] == ".":
            ans.append(np.count_nonzero(mawari=="#"))
        else:
            ans.append("#")
ans = np.array(ans).reshape(H,W).astype(np.unicode)
for i in ans:
    print("".join(i))


Measured memory_bytes: 12720
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
	int a, b, k, i, j;

	scanf("%d %d", &a, &b);

	for (k = 0; k < 1000000000; k++) {
		i = abs(a - k);
		j = abs(k - b);
		if (i == j) {
			printf("%d\n", k);
			return 0;
		}
	}

	printf("IMPOSSIBLE\n");

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) << endl ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }


int main(){
	ll n ; cin >> n ;
	ll ans = 0 ;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			ll cnt = 0 ;
			while(n%i==0){
				cnt++ ;
				n /= i ;
			}
            //cout << i << " " << cnt << endl ;
			ll l,r,m ;
			l = 0 ;
			r = 1e9 ;
			while(l+1<r){
				m = (l+r)/2 ;
				ll sub = (m+1)*m/2 ;
				if(sub>cnt) r = m ;
				else l = m ;
			}
			ans += l ;
            //cout << r << endl ;
		}
	}
	if(n!=1) ans++ ;
	cout << ans << endl ;
}

Measured memory_bytes: 3632
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))


ans = 1
c = h[0]
d = abs(h[0]-a)
h = [t-0.006*i for i in h]

for i in range(n):
    if abs(h[i]-a)<d:
        d=abs(h[i]-a)
        ans = i+1

print(ans)

Measured memory_bytes: 3064
from math import sqrt

q = int(input())
for _ in range(q):
    a, b = map(int, input().split())
    m = a * b
    s = int(sqrt(m))
    ans = 2 * s - 1
    if s * (s + 1) >= m:
        ans -= 1
    if s * s == m and a != b:
        ans -= 1
    print(ans)


Measured memory_bytes: 3060
import copy

num_of_switch, num_of_lights = [int(_) for _ in input().split()]
S = [[int(s) - 1 for s in input().split()[1:]] for i in range(num_of_lights)]
P = [_ == "1" for _ in input().split()]


def rec(switch_idx, lights):
    if switch_idx == num_of_switch:
        if lights == P:
            return 1
        else:
            return 0

    switch_off_result = rec(switch_idx + 1, lights)

    _lights = copy.deepcopy(lights)
    for light_idx in range(num_of_lights):
        # print(f"switch_idx = {switch_idx}, light_idx = {light_idx}")
        is_connect = switch_idx in S[light_idx]
        if is_connect:
            _lights[light_idx] = not _lights[light_idx]

    # print(f"switch_idx = {switch_idx}: not choose = {lights}, choose = {_lights} ")
    switch_on_result = rec(switch_idx + 1, _lights)
    return switch_off_result + switch_on_result


ans = rec(0, [False] * num_of_lights)
print(ans)


Measured memory_bytes: 9240
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,d; cin >> n >> d;
    int x[n][d];
    int ans = 0,cnt = 0;
    rep(i,n) rep(j,d) cin >> x[i][j];
    rep(i,n){
        FOR(j,i + 1,n){
            cnt = 0;
            rep(k,d) cnt += pow(x[i][k] - x[j][k],2);
          	if(floor(sqrt(cnt)) == sqrt(cnt)) ans++;
        }
    }
    ANS;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int ans = 0;

		for(int i = a; i <= b; i++){
			if(c % i == 0)ans++;
		}
			System.out.println(ans);
	}

}



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

using namespace std;

typedef long long ll;

bool cmp(pair<int, int> &a, pair<int, int> &b){
    if (a.second != b.second)
        return a.second < b.second;
    return a.first > b.first;
}

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(), a.end(), cmp);
    int time = 0;
    bool possible = true;
    for(auto elem : a){
        time += elem.first;
        if (time > elem.second){
            possible = false;
            break;
        }
    }
    if (!possible){
        cout << "No";
    } else {
        cout << "Yes";
    }
    return 0;
}


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

namespace ABC084A
{
	class Program
	{
		static void Main(string[] args)
		{
			int M, s;
			M = int.Parse(Console.ReadLine());
			s = 0;

			s += 24 + (24 - M);

			Console.Write(s);

			Console.ReadKey();

		}
	}
}


Measured memory_bytes: 13140
import java.io.*;
import  java.util.*;

import static java.lang.System.in;

class Main{
    int[][] rec = new int[1001][1001];
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int x = sc.nextInt(),y=sc.nextInt();
        int start=0,n=s.length;
        while(start<n&&s[start]=='F') start++;
        ArrayList<Integer> hori = new ArrayList<>(), vert = new ArrayList<>();
        int parity=0;
        int i=start;
        while(i<n){
            if(s[i]=='T'){
                parity = 1-parity;
                i++;
            }else{
                int j=i+1;
                while(j<n&&s[j]=='F') j++;
                if(parity==0) hori.add(j-i);
                else vert.add(j-i);
                i=j;
            }
        }
        String ans = help(x-start,hori)&&help(y,vert)?"Yes":"No";
        System.out.println(ans);
    }
    static boolean help(int target, ArrayList<Integer> step){
        int sum=0;
        for(int w:step) sum+=w;
        if(sum<Math.abs(target)) return false;
        if(sum==Math.abs(target)) return true;
        boolean[] cur = new boolean[2*sum+1], next = new boolean[2*sum+1];
        cur[sum]=true;
        for(int w:step){
            for(int j=0;j<=2*sum;j++){
                if(cur[j]){
                    next[j-w]=true;
                    next[j+w]=true;
                }
            }
            cur=next;
            next=new boolean[2*sum+1];
        }
        return cur[target+sum];
    }
}


Measured memory_bytes: 37844
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, 0, n){
        cin >> p[i];
        p[i]--;
    }
    int ans = 0;
    rep(i, 0, n){
        if(p[i] == i){
            ans++;
            swap(p[i], p[(i + 1) % n]);
        }
    }
    cout << ans << endl;
}

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

int main(){
    long long a,b,x;
    cin >> a >> b >> x;
    long long ans = 0;
    if (a == 0){
        ans = b / x + 1;
    }
    else {
        ans = b / x - (a-1) / x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import qualified Control.Monad as C
import qualified Data.List     as L
import Control.Applicative ((<$>))

solve :: Int -> IO ()
solve n = do
    rideAndLeftTimes <- concat <$> (C.forM [1..n] $ \_ -> do
        [ride, left] <- map read . words . filter (/= ':') <$> getLine :: IO [Int]
        return [(ride, 1), (left, -1)])
    print . maximum . scanl (+) 0 . map snd . L.sort $ rideAndLeftTimes
    main

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    C.when (n /= 0) $ solve n




Measured memory_bytes: 15432
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A[][] = new int[2][N];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < N; j++) {
                A[i][j] = sc.nextInt();
            }
        }

        int max_score = 0;
        int i_sum = 0;
        // i番目で曲がった
        for (int i = 0; i < N; i++) {
            i_sum += A[0][i];
            int score = i_sum;
            for (int j = i; j < N; j++) {
                score += A[1][j];
            }
            if (score > max_score) max_score = score;
        }
        System.out.println(max_score);
    }
}

Measured memory_bytes: 23892
import collections

n = int(input())
a = list(map(int, input().split()))
li = collections.Counter(a)
square = 0
rectangle = []
for i in li:
    if li[i] >= 2:
        rectangle.append(i)
    if li[i] >= 4:
        square = max(square, i)

rectangle.sort()

if len(rectangle) < 2 and square == 0:
    print(0)
elif len(rectangle) < 2:
    print(square**2)
else:
    print(max(square**2, rectangle[-1] * rectangle[-2]))

Measured memory_bytes: 18600
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pm(m) for(auto itr=(m).begin();itr!=(m).end();itr++){itr->first<<" "<<itr->second<<"\n";}
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
#define bug(x) cout<<(x)<<" ";exit(0);
int mod = 1000000007;
int mod1 = 998244353;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};
vector<int> matmul(vector<int> a,vector<int> b){
    vector<int> c(4,0);
    c[0] = (a[0]%mod*b[0]%mod + a[1]%mod*b[2]%mod)%mod;
    c[1] = (a[0]%mod*b[1]%mod + a[1]%mod*b[3]%mod)%mod;
    c[2] = (a[2]%mod*b[0]%mod + a[3]%mod*b[2]%mod)%mod;
    c[3] = (a[2]%mod*b[1]%mod + a[3]%mod*b[3]%mod)%mod;
    return c;
}
vector<int> id={1,0,0,1};
vector<int> dp(100000+5,-1);
vector<int> v(100+4);
int n;
bool solve(int k){
    if(k==0)return 0;
    if(k<0)return 1;
    if(dp[k]!=-1)return dp[k];
    for(int i=0;i<n;i++){
        bool ans = solve(k-v[i]);
        if(!ans){
            dp[k]=1;
            return 1;
        }
    }
    dp[k]=0;
    return 0;
}
int32_t main(){
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
	int k;
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>v[i];
	
	if(solve(k)){
	    cout<<"First";
	}
	else cout<<"Second";
    
}

Measured memory_bytes: 11068
#include<bits/stdc++.h>
using namespace std;
int main(){
  double n,d;
  int o=0;
  cin >> n >> d;
  while(n--){
    double a,b;
    cin >> a >> b;
    if(sqrt(a*a+b*b)<=d) {o++;}
  }
  cout << o;
  return 0;
}

Measured memory_bytes: 3876
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int a[4], b[2], total;

int main(){

	rep(i, 4)cin >> a[i];
	rep(i, 2)cin >> b[i];

	sort(a, a + 4);
	sort(b, b + 2);
	total = a[1] + a[2] + a[3] + b[1];

	cout << total << endl;

	return 0;
}


Measured memory_bytes: 3152
#include <iostream>
using namespace std;
int main(void){
    char a,b;
    cin>>a>>b;
    if(a<b){
        cout<<'<'<<endl;
    }
    else if(b<a){
        cout<<'>'<<endl;
    }
    else{
        cout<<'='<<endl;
    }
   
    
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> p(M);
    vector<string> S(M);
    REP(i, M)
    {
        cin >> p[i] >> S[i];
        p[i]--;
    }

    ll ac = 0, wa = 0;
    map<ll, bool> isAc;
    vector<ll> countWa(N, 0);
    REP(i, N) isAc[i] = false;
    REP(i, M)
    {
        if (S[i] == "AC")
        {
            if (!isAc[p[i]])
            {
                isAc[p[i]] = true;
                ac++;
                wa += countWa[p[i]];
            }
        }
        else if (S[i] == "WA")
        {
            if (!isAc[p[i]]) countWa[p[i]]++;
        }
    }

    cout << ac << " " << wa << endl;
}


Measured memory_bytes: 13568
#include <iostream>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[1<<18];
P p[1<<18];
llint dp[1<<18];

P maxp(P x, P y)
{
	if(x.first == y.first) return make_pair(x.first, y.first);
	if(y > x) swap(x, y);
	if(x.second > y.first) return x;
	else return make_pair(x.first, y.first);
}

int main(void)
{
	cin >> n;
	llint S = 1<<n;
	
	for(int i = 0; i < S; i++) cin >> a[i];
	for(int i = 0; i < S; i++) p[i] = make_pair(a[i], 0);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < S; j++){
			if(j&(1<<i)) p[j] = maxp(p[j], p[j^(1<<i)]);
		}
	}
	
	dp[0] = 0;
	for(int i = 1; i < S; i++){
		dp[i] = max(dp[i-1], p[i].first + p[i].second);
	}
	
	for(int i = 1; i < S; i++) cout << dp[i] << endl;
	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  llong N;
  vector<llong> A;

  cin >> N;
  A.resize(N);
  for (auto &in: A) {
    cin >> in;
  }

  llong ans = 0;
  for (int i = 1; i < N; i++) {
    if (A[i] < A[i - 1]) {
      ans += A[i - 1] - A[i];
      A[i] = A[i - 1];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4840
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC084D
    {
        static public void Main(string[] args)
        {
            var prime = new HashSet<int>(Prime(10000000));
            var sumary = new int[100001];
            for (int i = 1; i <= 100000; ++i)
            {
                if (prime.Contains(i) && prime.Contains((i + 1) / 2))
                {
                    sumary[i] = 1;
                }
            }
            for (int i = 1; i <= 100000; ++i)
                sumary[i] += sumary[i - 1];

            var Q = NextInt;
            for (int i = 0; i < Q; ++i)
            {
                var l = NextInt;
                var r = NextInt;
                Console.WriteLine(sumary[r] - sumary[l - 1]);
            }
        }

        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static int NextInt => Console_.NextInt();
        static long NextLong => Console_.NextLong();
        static string NextString => Console_.NextString();

        static IEnumerable<int> Prime(int x)
        {
            if (x < 2) yield break;
            yield return 2;
            var halfx = x / 2;
            var table = new bool[halfx + 1];
            var max = (int)(Math.Sqrt(x) / 2);
            for (int i = 1; i <= max; ++i)
            {
                if (!table[i])
                {
                    var add = 2 * i + 1;
                    yield return add;
                    for (int j = 2 * i * (i + 1); j <= halfx; j += add)
                    {
                        table[j] = true;
                    }
                }
            }
            for (int i = max + 1; i <= halfx; ++i)
            {
                if (!table[i]) yield return 2 * i + 1;
            }
        }
    }
}


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

int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for (int i=0; flag; i++){
        flag = 0;
        for (int j=N-1; j>=i+1; j--){
            if (A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}
int main(){
    int A[100], N, sw;
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    sw = bubbleSort(A, N);
    
    for (int i=0; i<N; i++){
        if (i){
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    
    return 0;
}


Measured memory_bytes: 3080
N = int(raw_input())
min = int(raw_input())
max = int(raw_input())

ans = max - min
if max < min:
    min = max
 
for i in range(N - 2):
    R = int(raw_input())
    if R - min > ans:
        ans = R - min
    if R < min:
        min = R
 
print ans

Measured memory_bytes: 12696
#include<stdio.h>

struct Card{
  char suit;
  char value;
};

void BubbleSort(struct Card *A, int length) {

  int i, j;
  char tmp;
  char tmp_1;

  for(i = 0; i < length; i++) {
    for(j = length-1; j > i; j--) {
      if(A[j].value < A[j-1].value) {

	tmp = A[j].value;
	tmp_1 = A[j].suit;

	A[j].value = A[j-1].value;
	A[j].suit = A[j-1].suit;

	A[j-1].value = tmp;
	A[j-1].suit = tmp_1;

      }
    }
  }
}

void SelectionSort(struct Card *A,int length) {

  int i, j, mini;
  char tmp;
  char tmp_1;

  for(i = 0; i < length; i++) {
    mini = i;
    for(j = i; j < length; j++) {
      if(A[j].value < A[mini].value) {
	mini = j;
      }
    }
    if(i != mini) {
    tmp = A[i].value;
    tmp_1 = A[i].suit;

    A[i].value = A[mini].value;
    A[i].suit = A[mini].suit;

    A[mini].value = tmp;
    A[mini].suit = tmp_1;

    }
  }
}



int main(){
  struct Card C1[101], C2[101];
  char table[9][4]={};
  int cnt[9]={};

  int n, i,j,flg=0;
  char ch;

  scanf("%d%c", &n, &ch);
  for ( i = 0; i < n; i++ ){
    scanf("%c%c%c", &C1[i].suit, &C1[i].value, &ch);
    table[C1[i].value-'1'][cnt[C1[i].value-'1']]=C1[i].suit;
    cnt[C1[i].value-'1']++;
  }
  for(i = 0; i < n; i++) {

    C2[i].suit = C1[i].suit;
    C2[i].value = C1[i].value;
  }

  BubbleSort(C1, n);
  SelectionSort(C2, n);


  for(i=0;i<9;i++)cnt[i]=0;

  if(table[C1[0].value-'1'][cnt[C1[0].value-'1']++]!=C1[0].suit)
    {
      flg=1;
    }
  printf("%c%c", C1[0].suit, C1[0].value);
  for(i = 1; i < n; i++) {
  if(table[C1[i].value-'1'][cnt[C1[i].value-'1']++]!=C1[i].suit)
    {
      flg=1;
    }
  printf(" %c%c", C1[i].suit, C1[i].value);
  }

  if(flg==0)
    printf("\nStable\n");
  else
    printf("\nNot stable\n");

  for(i=0;i<9;i++)cnt[i]=0;
  flg=0;

  if(table[C2[0].value-'1'][cnt[C2[0].value-'1']++]!=C2[0].suit)
    {
      flg=1;
    }


 printf("%c%c", C2[0].suit, C2[0].value);
  for(i = 1; i < n; i++) {
  if(table[C1[i].value-'1'][cnt[C1[i].value-'1']++]!=C2[i].suit)
    {
      flg=1;
    }
  printf(" %c%c", C2[i].suit, C2[i].value);
  }

  if(flg==0)
    printf("\nStable\n");
  else
    printf("\nNot stable\n");

  return 0;
}

Measured memory_bytes: 608
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
#include <complex>
using namespace std;
int main()
{
    int M;
    cin>>M;
    cout<<48-M;
    system ("pause"); 
    return 0;
}

Measured memory_bytes: 504
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

#print(a1, b1, a2, b2, a3, b3)
path = [[a1, b1], [a2, b2], [a3, b3]]
pos = [2]*4

#print(path)
#print(pos)
for pth in path:
    pos[pth[0]-1] -= 1
    pos[pth[1]-1] -= 1
#print(pos)
#print(pos.count(1))
#print(pos.count(0))
if pos.count(1) == 2 and pos.count(0) == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

class Main{
	public static void main(String[] a){
			Scanner sc=new Scanner(System.in);
			Integer[] input=new Integer[10];
			for(int i=0;i<10;i++){
				input[i]=Integer.parseInt(sc.nextLine());
			}
			Arrays.sort(input,Collections.reverseOrder());
		for(int j=0;j<3;j++){
		System.out.println(input[j]);
		}
	}
}

Measured memory_bytes: 26108
#include<bits/stdc++.h>
 
using namespace std;
 
int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if((a == b && b == c) || (a != b && b != c && a != c)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const  int N=1e5+20;
int fa[N];
int xfind(int x)
{
    return  fa[x]==x?x:fa[x]=xfind(fa[x]);
}
void into (int x,int y)
{
    int xx=xfind(x);
    int yy=xfind(y);
    if(xx!=yy)
        fa[xx]=yy;
}
int main()
{

    int n,m;
    cin>>n>>m;
    for(int i=1;i<=N;i++)
         fa[i]=i;
     int x,y;
     for(int i=1;i<=m;i++)
     {
         cin>>x>>y;
         into(x,y);
     }
     int cnt=0;
     for(int i=1;i<=n;i++)
     {
        if(fa[i]==i)
            cnt++;

     }
     cout<<cnt-1<<endl;


}


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

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

  vector<tuple<string, int, int>> vt(N);

  int i = 1;
  for (auto &t : vt) {
    int p;
    cin >> get<0> (t) >> p;
    get<1> (t) = - p;
    get<2> (t) = i;
    i++;
  }

  sort(vt.begin(), vt.end());

  for (auto &t : vt) {
    cout << get<2> (t) << endl;
  }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N;
vector<int> A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	if((N&(N+1))==0) {
		x=0;
		while(N) A.push_back(++x),N/=2;
		
		_P("%d\n",x*2);
		FOR(i,x) _P("%d ",A[i]);
		FOR(i,x) _P("%d%c",A[i],(i==x-1)?'\n':' ');
	}
	else {
		ll T=N/2;
		x=0;
		while(T) A.push_back(++x),T/=2;
		B=A;
		N -= (1LL<<x)-1;
		vector<int> C;
		y=x+1;
		FOR(i,A.size()) {
			C.push_back(A[i]);
			if(N&(1LL<<(x-1-i))) {
				C.push_back(y);
				B.insert(B.begin(),y);
				y++;
			}
		}
		_P("%d\n",B.size()+C.size());
		FORR(r,C) _P("%d ",r);
		FOR(i,B.size()) _P("%d%c",B[i],(i==B.size()-1)?'\n':' ');
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a;
    cin>>a;
   
        for(int i=1;i<10;i++){
            for(int j=1;j<10;j++){
                if(a==i*j){
                     printf("Yes");
                     return 0;
                }
            }
        }
        
        printf("No");
    
}

Measured memory_bytes: 256
#C
N,M,D = map(int,input().split())
S = [list(str(input())) for i in range(N)]
ans = 0

for i in range(N):
    yoko = S[i]
    count = 0
    for j in range(M):
        if yoko[j] == ".":
            count+=1
            if count >= D:
                ans+=1
        else:
            count = 0
            
T = [["" for i in range(N)] for j in range(M)]
for i in range(N):
    for j in range(M):
        T[j][i] = S[i][j]
        
for j in range(M):
    tate = T[j]
    count = 0
    for i in range(N):
        if tate[i] == ".":
            count+=1
            if count >= D:
                ans+=1
        else:
            count = 0
            
print(ans)




Measured memory_bytes: 5736
#include<stdio.h>
#include<string.h>
int main()
{
    int H,W,l,i;
    char a[101][101];
    scanf("%d%d",&H,&W);
    for(i=0;i<H;i++)
    {
        scanf("%s",&a[i]);
    }
    l=W+2;
    for(i=0;i<l;i++)
    {
        printf("#");
    }
        printf("\n");
    for(i=0;i<H;i++)
    {
        printf("#%s#\n",a[i]);
    }
    for(i=0;i<l;i++)
    {
        printf("#");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 128