akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  vector<int> indexToPrime;
  REPP(i,n){
    if(prime(i)){
      indexToPrime.push_back(i);
    }
  }
  
  int p = indexToPrime.size();
  int e[p]={};
  int temp;
  REPP(i,n){
    temp = i;
    REP(j,p){
      while(temp%indexToPrime[j]==0){
        temp /= indexToPrime[j];
        e[j]++;
      }
    }
  }
  
  int ans=0;
  int cnte[75]={};//N!をi回以上割り切れるような素数が何個あるかを格納する配列
  REP(i,75){
    REP(j,p){
      if(e[j]>=i){
        cnte[i]++;
      }
    }
  }
  
  ans += cnte[74];
  REP(i,p){
    REP(j,i){
      if(e[i]>=24 && e[j]>=2){
        ans++;
      }
      if(e[i]>=2 && e[j]>=24){
        ans++;
      }
      if(e[i]>=4 && e[j]>=14){
        ans++;
      }
      if(e[i]>=14 && e[j]>=4){
        ans++;
      }
    }
  }
  //ans += cnte[24]*max(0,cnte[2]-1);
  //ans += cnte[14]*max(0,cnte[4]-1);
  
  REP(i,p){
    REP(j,i){
      REP(k,j){
        if((e[i]>=4 && e[j]>=2 && e[k]>=4)){
          ans++;
        }
        if((e[i]>=4 && e[j]>=4 && e[k]>=2)){
          ans++;
        }
        if((e[i]>=2 && e[j]>=4 && e[k]>=4)){
          ans++;
        }
      }
    }
  }
  //ans += cnte[4]*max(0,cnte[2]-1)*max(0,cnte[2]-2)/2;
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        if(n < 10){
            System.out.println(r+ (10 - n) * 100);
        
        }else{
            System.out.println(r);
        }
    }
}


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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  for (int i = A; i <= B; i++) {
    if (i % K == 0) return cout << "OK" << "\n", 0;
  }
  cout << "NG" << "\n";
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <climits>

using namespace std;

int main(){
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    for(int i = 0; i < M; i++){
        cin >> A[i];
    }
    
    int ans = INT_MAX;
    int l_sum = 0, r_sum = 0;;
    for(int i = 0; i < M; i++){
        if(A[i] < X){
            l_sum++;
        }
        else if(A[i] > X){
            r_sum++;
        }
        else    ;
    }
    ans = min({ans, l_sum, r_sum});
    
    cout << ans << endl;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
    a,b,c,d,e = i//10000,(i%10000)//1000,(i%1000)//100,(i%100)//10,i%10
    if a == e and b == d:
        cnt += 1
        
print(cnt)

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int i,n,data[10001],min,max;
    long long sum=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    max=data[0];
    min=data[0];
    for(i=0;i<n;i++){
        if(max<data[i]){
            max=data[i];
        }
        else if(min>data[i]){
            min=data[i];
        }
        sum=sum+data[i];
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}

Measured memory_bytes: 1812
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    a-=c;
    cout<<a/(b+c)<<endl;
    return 0;
}

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

struct Node{
  int key;
  Node *right,*left,*parent;
};


Node *root, *NIL;

Node * find(Node *u,int k){
  while(u!=NIL && k!=u->key){
    if(k<u->key) u=u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    cin >> com;

    if(com[0] == 'f'){
      scanf("%d",&x);
      Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }else if(com == "insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 21936
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,i,j,ans=1e15,z,z2;
            cin>>n;
            ll x=sqrt(n);
            for(i=1;i<=x;++i)
            {
                if(n%i==0)
                {
                    //cout<<i<<" "<<n/i<<endl;
                    z=i;
                    z2=n/i;
                    ans=min(ans,z-1+z2-1);
                }
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
#include<iomanip>
#include<limits>
using namespace std;
int main(void){
   string s;
   cin>>s;
   for(int i=0;i<s.length();i++){
       if((i+1)%2==1){
           if(s[i]=='R' or s[i]=='U' or s[i]=='D'){
               continue;
           }
           else{
               cout<<"No"<<endl;
               return 0;
           }
       }
       else{
           if(s[i]=='L' or s[i]=='U' or s[i]=='D'){
               continue;
           }
           else{
               cout<<"No"<<endl;
               return 0;
           }
       }
   }
   cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long L, long long R){
	ll res = 2020;
	ll l;
	if (R-L > 2019) l = 2019; else l = R-L;
	for (ll i = L%2019; i < L%2019+l; i++) {
		for (ll j = i+1; j <= L%2019+l; j++) {
			// cout << i << " " << j << " " << (i*j)%2019 << endl;
			if (i < j) res = min(res, (i*j)%2019);
		} 
	} 
	cout << res << endl;
}

int main(){	
	long long R;
	long long L;
	scanf("%lld",&L);
	scanf("%lld",&R);
	solve(L, R);
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int n;
signed main() {
	cin >> n;
	if (n == 1) { cout << "1\n0\n"; return 0; }
	if (n == 2) { cout << "2\n0\n11\n"; return 0; }
	else {
		cout << n - 1 << endl;
		for (int i = 2; i <= n; i++) {
			int j = i - 2;
			printf("1");
			while (j-- > 0)printf("0");
			printf("1\n");
		}
	}
}


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		long[] list = new long[1000000];
		long sum =0;
		int x;
		for(int i=0;i<N;i++) {
			x = Integer.parseInt(scanner.next());
			list[x]++;
			sum += x;
		}
		int Q = Integer.parseInt(scanner.next());
		int b,c;
		for(int i=0;i<Q;i++) {
			b = Integer.parseInt(scanner.next());
			c = Integer.parseInt(scanner.next());
			sum += (c-b)*list[b];
			list[c] += list[b];
			list[b] =0;
			System.out.println(sum);
		}
		scanner.close();
	}
}

Measured memory_bytes: 68536
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto K = RD;
	auto x = RDR.ARR;
	long ans;
	foreach (i; 0..N)
	{
		ans += min(x[i], abs(x[i] - K)) * 2;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <cstddef>
#include <vector>

template <class S>
void subset_zeta_transform(std::vector<typename S::value_type> &a) {
  using size_t = std::size_t;

  const size_t n = a.size();
  for (size_t i = 1; i < n; i *= 2) {
    for (size_t j = 0; j != n; j += 1) {
      if ((j & i) != 0)
        a[j] = S::operation(a[j & ~i], a[j]);
    }
  }
}

template <class S>
void superset_zeta_transform(std::vector<typename S::value_type> &a) {
  using size_t = std::size_t;

  const size_t n = a.size();
  for (size_t i = 1; i < n; i *= 2) {
    for (size_t j = 0; j != n; j += 1) {
      if ((j & i) != 0)
        a[j & ~i] = S::operation(a[j & ~i], a[j]);
    }
  }
}

template <class G>
void subset_mobius_transform(std::vector<typename G::value_type> &a) {
  using size_t = std::size_t;

  const size_t n = a.size();
  size_t i = 1;
  while (i < n)
    i *= 2;
  while (i != 1) {
    i /= 2;
    for (size_t j = 0; j != n; j += 1) {
      if ((j & i) != 0)
        a[j] = G::operation(G::inverse(a[j & ~i]), a[j]);
    }
  }
}

template <class G>
void superset_mobius_transform(std::vector<typename G::value_type> &a) {
  using size_t = std::size_t;

  const size_t n = a.size();
  size_t i = 1;
  while (i < n)
    i *= 2;
  while (i != 1) {
    i /= 2;
    for (size_t j = 0; j != n; j += 1) {
      if ((j & i) != 0)
        a[j & ~i] = G::operation(a[j & ~i], G::inverse(a[j]));
    }
  }
}

#include <algorithm>
#include <array>
#include <cstdio>
#include <functional>


int scan() {
  int r = 0, c;
  while ((c = getchar_unlocked() - '0') >= 0)
    r = r * 10 + c;
  return r;
}

struct top2 {
  using value_type = std::array<int, 2>;

  static value_type operation(const value_type &l, const value_type &r) {
    std::array<int, 4> v = {l[0], l[1], r[0], r[1]};
    std::sort(v.begin(), v.end(), std::greater<int>());
    return {v[0], v[1]};
  }
  static constexpr value_type identity = {0, 0};
};
constexpr typename top2::value_type top2::identity;

int main() {
  const int n = scan();
  std::vector<top2::value_type> a(1 << n);

  for (auto &e : a) {
    e[0] = scan();
  }

  subset_zeta_transform<top2>(a);
  a.erase(a.begin());
  int cur = 0;
  for (const auto &e : a) {
    cur = std::max(cur, e[0] + e[1]);
    printf("%d\n", cur);
  }
  return 0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

vector<P> v1,v2;
bool used[200];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a>>b;
		v1.push_back(make_pair(a,b));
	}
	for(i=0;i<n;i++){
		cin>>a>>b;
		v2.push_back(make_pair(a,b));
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	int s=0;
	for(i=0;i<n;i++){
		a=-1;
		for(j=0;j<n;j++){
			if(v2[i].first<=v1[j].first)break;
			if(v2[i].second<=v1[j].second || used[j])continue;
			if(a==-1 || v1[a].second<v1[j].second)a=j;
		}
		if(a==-1)continue;
		used[a]=true,s++;
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let s = get!(String).chars().collect::<Vec<_>>();

    let mut first = HashMap::new();
    for i in 0..1usize<<n {
        let mut red = String::new();
        let mut blue = String::new();
        for j in 0..n {
            if (i>>j)%2 == 1 {
                red.push(s[j]);
            } else {
                blue.push(s[j]);
            }
        }
        let blue = blue.chars().rev().collect::<String>();
        *first.entry((red,blue)).or_insert(0) += 1;
    }

    let mut res = 0usize;
    for i in 0..1usize<<n {
        let mut red = String::new();
        let mut blue = String::new();
        for j in 0..n {
            if (i>>j)%2 == 1 {
                red.push(s[j+n]);
            } else {
                blue.push(s[j+n]);
            }
        }
        let blue = blue.chars().rev().collect::<String>();
        if let Some(val) = first.get(&(blue, red)) {
            res += *val;
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 63852
h, w = map(int, input().split())
A = [[] for _ in range(h)]
for i in range(h):
    A[i] = list(input())

from collections import deque

visited = [[False] * w for _ in range(h)]

q = deque()
for i in range(h):
    for j in range(w):
        if A[i][j] == '#':
            q.append((i, j, 0))
            visited[i][j] = True

cnt = 0
while q:
    y, x, count = q.popleft()
    cnt = max(cnt, count)
    for dy, dx in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
        ny, nx = y + dy, x + dx
        if ny < 0 or ny >= h or nx < 0 or nx >= w: continue
        if visited[ny][nx]: continue
        q.append((ny, nx, count + 1))
        visited[ny][nx] = True
print(cnt)

Measured memory_bytes: 223460
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        String str=sc.next();
        int n=str.length();
        str=str+"R";
        
        String[] s = str.split("");
        
        boolean rflag=true;
        int j=0;
        
        int ans[] = new int[n];
        
        for(int i=0;i<=n;i++){
            if(rflag&&s[i].equals("L")){
                ans[i]+=(i-j)/2;
                ans[i-1]+=(i-j)/2;
                if((i-j)%2==1){
                    ans[i-1]++;
                }
                j=i;
                rflag=false;
            }else if(!rflag&&s[i].equals("R")){
                ans[j]+=(i-j)/2;
                ans[j-1]+=(i-j)/2;
                if((i-j)%2==1){
                    ans[j]++;
                }
                j=i;
                rflag=true;
            }
        }
        
        for(int i=0;i<n;i++){
            System.out.print(ans[i]+" ");
        }
    }
}


Measured memory_bytes: 41928
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getInputListInt()

tmp = True

while tmp:
    data.sort()

    for i in range(len(data)-1, 0, -1):
        divi = data[i] % data[0]
        if divi == 0:
            data.pop(i)
        else:
            data[i] = divi

    if data[0] == min(data):
        tmp = False

print(data[0])


Measured memory_bytes: 24116
def dif(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(input())

txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(dif, zip(txy, txy[1:])))

for i in range(n):
    dt, dx, dy = dtxy[i]
    if  dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 37132
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

//ただの辺
struct edge {
    using lint = long long int;
    int to;
    lint cost;
    //引数一つの時は距離1
    edge(int t, lint c = 1) : to(t), cost(c) {
    }
};

// 木のlcaをキビキビ計算
// depend:edge
struct lowest_common_ancestor {
    using G = vector<vector<edge>>&;
    G g;
    int sz;
    int root;
    int log;
    vector<int> dep;
    vector<vector<int>> parent;
    lowest_common_ancestor(G _g, int _root)
        : g(_g), sz(_g.size()), root(_root), dep(_g.size()) {
        log = 1;
        while (1 << log < sz) log++;
        parent.assign(log, vector<int>(sz, -1));
    }
    // parent[0]埋め、深さ埋め
    void dfs(int now, int p, int d) {
        parent[0][now] = p;
        dep[now] = d;
        for (int i = 0; i < (int)g[now].size(); i++) {
            int next = g[now][i].to;
            if (next != p) dfs(next, now, d + 1);
        }
    }
    // 前計算を済ませる O(nlog n)
    void build() {
        dfs(root, -1, 0);
        for (int i = 1; i < log; i++) {
            for (int j = 0; j < sz; j++) {
                if (parent[i - 1][j] == -1)
                    parent[i][j] = -1;
                else
                    parent[i][j] = parent[i - 1][parent[i - 1][j]];
            }
        }
    }
    // uとvのlcaを求める O(log sz)
    int query(int u, int v) {
        if (dep[u] > dep[v]) swap(u, v);
        for (int i = 0; i < log; i++) {
            if ((dep[v] - dep[u]) & (1 << i)) v = parent[i][v];
        }
        if (u == v) return u;
        for (int i = log - 1; i >= 0; i--) {
            if (parent[i][u] != parent[i][v])
                u = parent[i][u], v = parent[i][v];
        }
        return parent[0][u];
    }
};

int main() {
    int n;
    cin >> n;
    vector<vector<edge>> g(n);
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int c;
            cin >> c;
            g[i].push_back(edge(c));
            g[c].push_back(edge(i));
        }
    }
    lowest_common_ancestor lca(g, 0);
    lca.build();
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int u, v;
        cin >> u >> v;
        cout << lca.query(u, v) << endl;
    }
}


Measured memory_bytes: 19912
var s:string;i:longint;c,f:boolean;
begin
read(s);
for i:=1 to length(s) do
begin
if s[i]='C' then c:=true;
if s[i]='F' then f:=true;
if not(c) then f:=false;
end;
if f then writeln('Yes') else writeln('No');
end.

Measured memory_bytes: 128
#include "stdio.h"
#include "math.h"
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <iostream>

using namespace std;
/** Problem0078 : Magic Square **/
int main()
{
	int sq[15][15], n, oldX, oldY;
	
	while (cin >> n && n != 0) {
		memset(sq, 0, sizeof(sq));
		
		sq[n/2][n/2+1] = 1;
		oldX = n/2; oldY = n/2+1;
		
		for (int i=2;i<=n*n;i++) {
			if (sq[(oldX+1)%n][(oldY+1)%n] == 0) {
				sq[(oldX+1)%n][(oldY+1)%n] = i;
				oldX = (oldX+1)%n; oldY = (oldY+1)%n;
			} else {
				sq[oldX][(oldY+2)%n] = i;
				oldY = (oldY+2)%n;
			}
			
		}
		
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				cout << setw(4) << right << sq[j][i];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1172
import collections

N = int(input())
A = list(map(int,input().split()))
cc = dict(collections.Counter(A))
ans = 0
max_1 = 0
max_2 = 0
max_3 = 0
for i in cc.items():
  if (i[0] > max_1 and i[1] >= 2):
    max_2 = max_1
    max_1 = i[0]
  elif (i[0] > max_2 and i[1] >= 2):
    max_2 = i[0]
  if (i[1] >= 4):
    max_3 = max(max_3,i[0])
print(max(max_1*max_2,max_3**2))

Measured memory_bytes: 75288
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

ll digits(ll m){
    ll count = 0;
    if(m == 0)return 1;
    while (m > 0){
        m /= 10;
        count++;
     }
     return count;
}
int main() {
    int n,m; cin >> n >> m;
    map<int,int> a;
    rep(i,m){
        int s,c; cin >> s >> c;
        if(a.count(s) != 0 && a[s] != c){
            print(-1);
            return 0;
        }
        a[s] = c; 
    }

    rep(i,1000){
        if(digits(i) != n)continue;
        string num_to_s = to_string(i);
        bool flag = true;
        for(auto it : a){
            if(num_to_s[it.first - 1] - '0' != it.second){
                flag = false;
                break;
            }
        }
        if(flag){
            print(i);
            return 0;
        }
    }
    print(-1);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define N 100055
#define ll long long
int n,k,ar[N];
bool dp[N];

int main() {
    scanf("%d%d",&n,&k);
    for(int i=1; i<=n; ++i) {
        scanf("%d",&ar[i]);
        dp[ar[i]] = 1;
    }

    for(int i=1; i<=k; ++i) {
        for(int j=1; j<=n; ++j) {
            if(i+ar[j]<=k)
                dp[i+ar[j]] = max(!dp[i], dp[i + ar[j] ]);
        }
//        cout << dp[i] << " ";
    }
//    cout << "\n";
    cout << (dp[k]?"First":"Second");

    return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int N; cin >> N;
  vector<long long> A(N+1);
  vector<long long> S(N+1, 0);
  for(int i = 1; i <= N; ++i) {
    cin >> A[i];
    S[i] = S[i-1] + A[i];
  }
  long long ans = S[N];
  int l = 1, r=3;
  for(int i = 2; i <= N-2; ++i) {
    long long last = S[N];
    while(l < i) {
      long long d = abs(S[i]-S[l] * 2);
      if(d > last) break;
      else last = d;
      l++;
    }
    l--;
    last = S[N];
    while(r < N) {
      long long d = abs(S[N]+S[i]-S[r] *2);
      if(d > last) break;
      else last = d;
      r++;
    }
    r--;
    long long up   = max(max(max(S[l], S[i]-S[l]), S[r]-S[i]), S[N]-S[r]);
    long long down = min(min(min(S[l], S[i]-S[l]), S[r]-S[i]), S[N]-S[r]);
    ans = min(ans, up - down);
  }
  cout << ans << endl;


  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

int N;

int solve(){
    int minimum = 1e13;
    for(int i=1; i*i<=N; i++){
        if(N%i==0) minimum = min(minimum, i + N/i - 2);
    }
    return minimum;
}

signed main(){
    cin >> N;
    cout << solve() << endl;
}

Measured memory_bytes: 256
// abc176_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int idx=0;idx<(n-1);idx++) cout << (vec)[idx] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << "\n";}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string N;
    cin >> N;

    int x = 0;
    REP(i, N.size()){
        int c = N[i] - '0';
        x = (x + c) % 9;
    }

    if (x == 0){
        print("Yes");
    } else {
        print("No");
    }


    return 0;
}


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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 

    int k; cin >> k;
    int val = 7%k;
    for (int i = 1; i < 1e6 + 10; i++) {
        if (val % k == 0) {
            cout << i << endl;
            return 0;
        }
        val = (val * 10 + 7) % k;
    }

    cout << -1 << endl;


    return 0; 
}



Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;

}



Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import java.io.*;

public class Main {
	static FastScanner sc = new FastScanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		LinkedList<Integer> s = new LinkedList<>();
		for (int i=0; i<n; i++) {
			s.add(sc.nextInt());
		}
		int m = sc.nextInt();
		int num = 0;
		for (int i=0; i<m; i++) {
			if (s.contains(sc.nextInt())) {num++;}
		}
		out.println(num);
	}
}



class FastScanner implements Closeable {
	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	public FastScanner(InputStream in) {this.in = in;}
	private boolean hasNextByte() {
		if (ptr < buflen) {return true;}
		else{
			ptr = 0;
			try {buflen = in.read(buffer);}
			catch (IOException e) {e.printStackTrace();}
			if (buflen <= 0) {return false;}
		}
		return true;
	}
	private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {throw new NumberFormatException();}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}
			else{throw new NumberFormatException();}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() { return Double.parseDouble(next());}
	public void close() {
		try {in.close();}
		catch (IOException e) {}
	}
}


Measured memory_bytes: 26764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    char x;cin >> x;
    if(isupper(x))cout << 'A' <<endl;
    else cout << 'a' <<endl;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL a,b,c;
int main() {
	cin>>a>>b>>c;
	// 2sqrt(ab), c-a-b
	LL A=4*a*b;
	if(c-a-b<0) return !printf("No\n");
	LL B=(c-a-b)*(c-a-b);
	printf("%s\n", A<B?"Yes":"No");
}

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

int a[5050], p[5050], vis[5050];
int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> p[i];
	for (int i = 1; i <= n; i++) cin >> a[i];
	long long ans = -2e18;
	for (int x = 1; x <= n; x++) {
		if (vis[x]) continue;
		vector<int> v;
		long long sum = 0;
		while (!vis[x]) {
			vis[x] = 1;
			v.push_back(a[x]);
			sum += a[x];
			x = p[x];
		}
		auto t = v;
		for (auto x: t) v.push_back(x);
		int sz = t.size();
		for (int i = 0; i < sz; i++) {
			long long cur = 0;
			for (int j = i; j < i + sz; j++) {
				cur += v[j];
				if (j - i + 1 <= k) {
					ans = max(ans, cur);
					ans = max(ans, cur + (k - (j - i + 1)) / sz * sum);
				}
			}
		}
	}
	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3816
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static String line;
	static final int MOD = 100000007;

	static long solve(int len, int loop) {
		long ret = 0;
		long[] dp = new long[len + 1];
		dp[0] = 1;
		for (int i = 1; i <= len; ++i) {
			for (int j = 1; j <= Math.min(loop, i); ++j) {
				dp[i] += dp[i - j];
			}
			dp[i] %= MOD;
			if ((len - i) % loop == 0) {
				ret += dp[i];
				ret %= MOD;
			}
		}
		return ret;
	}

	static int solve() {
		long ans = 1;
		int prev = 0;
		for (int i = 1; i < line.length(); ++i) {
			if (line.charAt(i) != line.charAt(i - 1)) {
				ans *= solve(i - prev, loop(line.charAt(prev)));
				ans %= MOD;
				prev = i;
			}
		}
		ans *= solve(line.length() - prev, loop(line.charAt(prev)));
		ans %= MOD;
		return (int) ans;
	}

	static int loop(char c) {
		return c == '8' || c == '0' ? 3 : 5;
	}

	public static void main(String[] args) throws Exception {
		while (true) {
			line = sc.next();
			if (line.equals("#")) break;
			System.out.println(solve());
		}
	}
}

Measured memory_bytes: 16000
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin


def main():
    num = int(stdin.readline())

    for _ in xrange(num):
        x = stdin.readline().rstrip()
        y = stdin.readline().rstrip()

        n = len(y) + 1

        cim1 = [0] * n
        for i, xi in enumerate(x, start=1):
            ci = [0] * n
            for j, yj in enumerate(y, start=1):
                if xi == yj:
                    ci[j] = cim1[j-1] + 1
                elif cim1[j] >= ci[j-1]:
                    ci[j] = cim1[j]
                else:
                    ci[j] = ci[j-1]
            cim1 = ci

        print(ci[j])


main()

Measured memory_bytes: 4304
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
flag = 0
x, y = map(int, input().split())
if x in a:
    if y in a:
        flag = 1
if x in b:
    if y in b:
        flag = 1
if x in c:
    if y in c:
        flag = 1
print("Yes") if flag == 1 else print("No")

Measured memory_bytes: 3064
'use strict';
const main = input => {
  input = input[0].split(' ').map(val => parseInt(val));
  const a = input[0], b = input[1];
  if (a < 10 && b < 10) {
    console.log(a*b);
  } else {
    console.log(-1);
    
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i;
  int count = 1;
  for(i=1;i<n;i++){
    if(s.at(i-1)==s.at(i)){
      continue;
    }else{
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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


cnt = 0
path = []
visited = [False]*n
junban = [-1]*n

now = 0
while True:

    if visited[now]:
        loopstart = now
        break
    else:
        path.append(now)
        junban[now] = cnt
        visited[now]=True
        loopend = now
        cnt+=1
        now = a[now]-1

loopsize = junban[loopend] - junban[loopstart] + 1

if k < junban[loopend]:
    print(path[k]+1)
else:
    ans = path[junban[loopstart]+ (k-junban[loopstart])%loopsize]
    print(ans+1)


Measured memory_bytes: 33904
//An Odd Problem

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    nvarep(n,a);
    int ans = 0;
    rep(i,0,n){
        if((i+1)%2&&a[i]%2)ans++;
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

int dp[105][4][2];

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int K;
  cin >> K;
  dp[0][0][0] = 1;
  rep(i, n) rep(j, 4) rep(k, 2) {
    int nd = s[i] - '0';
    rep(d, 10) {
      int ni = i + 1, nj = j, nk = k;
      if(d != 0) nj++;
      if(nj > K) continue;
      if(k == 0) {
        if(d > nd) continue;
        if(d < nd) nk = 1;
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }

  cout << (dp[n][K][0] + dp[n][K][1]) << endl;
  return 0;
}

Measured memory_bytes: 256
def solve():
  dic = {}
  while True:
    a, b = map(int, input().split())
    if not a:
      break
  
    if a in dic:
      dic[a] += 1
    else:
      dic[a] = 1
  
    if b in dic:
      dic[b] += 1
    else:
      dic[b] = 1
  
  #スタートとゴールの次数が偶数ならNG
  if not dic[1] % 2 or not dic[2] % 2:
    print("NG")

  else:
    #それ以外の頂点の次数が奇数ならNG
    for k in dic:
      if not k in (1,2) and dic[k] % 2:
        print("NG")
        break
    #それ以外はOK
    else:
      print("OK")

while True:
  try:
    solve()
  except EOFError:
    break


Measured memory_bytes: 5608
#include <iostream>
#define C cout<<
using namespace std;

/**
AOJ ITP1_5_B Print a Frame.
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_B
*/
main() {
    int H,W,i,j;
    while(cin>>H>>W&&H){
        for(i=0;i<H;i++,C"#\n")for(j=0;j<W-1;j++)C(i*(i+1-H)*j?".":"#");
        C"\n";
    }
}

Measured memory_bytes: 3044
from collections import deque
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = [deque(map(lambda x: int(x)-1, input().split())) for _ in range(N)]
    ans = 0
    used_prev = set(range(N))
    while any(A):
        used = set()
        for i in used_prev:
            a = A[i]
            if not a or i in used:
                continue
            j = a[0]
            b = A[j]
            if not b or j in used:
                continue
            if i == b[0]:
                A[i].popleft()
                A[j].popleft()
                used.add(i)
                used.add(j)
        if not used:
            ans = -1
            break
        used_prev = used
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()


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

int main (){
string n;
cin>>n;
sort(n.begin(),n.end());
if(n[0]==n[1] and n[2]==n[3] && n[1] != n[2]){
    cout<<"Yes";
}
else {
    cout<<"No";
}
}


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

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N =  int.Parse(Console.ReadLine());
    //CompLib.Collections.PriorityQueue<?>
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        string output = "";

        if (N % 2 != 0)
        {
            output = "No";
        }
        else
        {
            int div = N / 2;
            string a = S.Substring(0, div);
            string b = S.Substring(div, div);
            if (a == b)
            {
                output = "Yes";
            }
            else
            {
                output = "No";
            }

        }
        Console.WriteLine(output);
    }
   

}





Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int size=16;
    int A, B; cin >> A >> B;
    
    if(max(A, B)>(size/2)){ cout << ":(" << endl; return 0; }
    cout << "Yay!" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
main(){for(int N,M,P,X,S,i,m;std::cin>>N>>M>>P,N|M|P;m?printf("%d\n",S*(100-P)/m):puts("0"))for(S=i=0;i<N;S+=X*100,i++-M+1||(m=X*100))std::cin>>X;}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,0,n){
        cin>>a[i];
    }

    for(int i=k;i<n;i++){
        if(a[i-k]<a[i])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=2147483647;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
ll x,ans,num=100;
int main(){
	x=read();
	while(num<x){
		num+=num/100;
		++ans;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3744