akhauriyash/Code-Regression huggingface dataset:
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		s.close();
		double x = (double)a / (double)b;
		String bd = new BigDecimal(x).toPlainString();
		System.out.println((a/b) + " " + (a%b) + " " + bd);
	}

}

Measured memory_bytes: 26560
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	int N;
	cin >> N;
	int M = N;

	while (N > 0) {
		if (N % 7 == 0) {
			cout << "Yes" << endl;
			return 0;
		}

		N -= 4;
	}

	while (M > 0) {
		if (M % 4 == 0) {
			cout << "Yes" << endl;
			return 0;
		}

		M -= 7;
	}

	cout << "No" << endl;

	/*ll N, M;
	cin >> N >> M;
	vll A(N);
	cin >> A;

	int l = 0, r = 0;
	ll sum = A[0];
	ll ans = 0;
	while (true) {
		cout << "l:" << l << " r:" << r << " sum:" << sum << endl;
		if (sum % M == 0) {
			ans++;
		}

		if (r == N && l == N) {
			cout << ans << endl;
			return 0;
		}
			
		if (r < N - 1 && (A[l] % 2 == 0 || l == r)) {
			r++;
			sum += A[r];
		}
		else if (l < r){
			sum -= A[l];
			l++;
		}
		else {
			cout << ans << endl;
			return 0;
		}
	}
	
*/
	return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
int main(){
int n,a,b,c,d; cin >> n >> a >> b >> c >> d;
a--;b--;c--;d--;
string s; cin >> s;
int mx = max(c,d),mn=min(c,d);
int flag = 1,flag2=0;
for (int i = a; i < mx-1; ++i)
{
    if (s[i] == '#'&&s[i+1] == '#')
    {
        flag = 0;
        break;
    }
}

for (int i = b-1; i < mn; ++i)
{
    if (s[i] == '.'&&s[i+1] == '.'&&s[i+2] == '.')
    {
        flag2 = 1;
        break;
    }
}
if (c>d&&flag2==0)
{
   flag = 0;
}
if (flag)
{
    cout << "Yes";
}
else cout << "No";
return 0;
}



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

#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define int long long




signed main()
{
    cin.tie(0);
    cout.tie(0);
    cin.sync_with_stdio(0);
    string s;
    cin >> s;
    int k;
    cin >> k;
   /*  int cur = 0;
    for(int i = 0; i < s.size(); ++i) {
        char c = s[i];
        int cc = 0;
        while(s[i] == c) {
            ++i;
            ++cc;
        }
        cur += cc / 2;
        --i;
    }
    if (k == 1) {
        cout << cur;
        return 0;
    }
    if (s[0] != s.back()) {
        cout << cur * k;
        return 0;
    }
    */
    bool bd = true;
    for(int i = 1; i < s.size(); ++i) {
        bd &= (s[i] == s[i - 1]);
    }
    if (bd) {
        int num = (int)s.size() * k;
        cout << num / 2;
        return 0;
    }
    string a = s;
    int cur_l = 0;
    for(int i = 0; i < a.size(); ++i) {
        if (a[i] != a.back()) {
            cur_l = i;
            break;
        }
    }
    int cur_r = (int)a.size() - 1;
    for(int i = a.size() - 1; i >= 0; --i) {
        if (a[i] != a[0]) {
            cur_r = i;
            break;
        }
    }
    int rs1 = 0;
    for(int i = cur_l; i <= cur_r; ++i) {
        char c = a[i];
        int cc = 0;
        while(i <= cur_r && a[i] == c) {
            ++i;
            ++cc;
        }
        rs1 += cc / 2;
        --i;
    }
    // cout << cur_r << ' ' << cur_l << endl;
    int pp = (cur_l + (int)a.size() - cur_r - 1) / 2;
    int p1 = (cur_l) / 2;
    int p2 = ((int)a.size() - cur_r - 1) / 2;
    cout << pp * (k - 1) + rs1 * k + p1 + p2;
    return 0;
}


Measured memory_bytes: 256
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
h = IL()

ans = 0
for i in h:
  if i >= K:
    ans += 1

print(ans)

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

int main() {
    
    int a, b, c=0;
    cin >> a >> b;
    int arr[a];
    for(int i=0; i<a; i++){
        cin >> arr[i];
        if(arr[i]>=b){
            ++c;
        }
    }
    
    cout << c << endl;
    
    
    
    
    
	return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);

int main(){
    ll n,d;cin>>n>>d;
    int ans =0;
    rep(i,n){
        ll x,y;cin>>x>>y;
        if(d*d>=x*x+y*y)ans++;
    }
    cout<<ans<<endl;
}

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

int main(){
	int n;
	cin >> n;
	
	int v[n];
	int c[n];
	for(int i=0; i<n; i++) cin >> v[i];
	for(int i=0; i<n; i++) cin >> c[i];
	
	int ans=0;
	for(int i=0; i<n; i++){
		if(v[i]>c[i]) ans += v[i]-c[i];
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from fractions import gcd

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))

    l = lcm_base(A[0], A[1])
    for a in A[2:]:
        l = lcm_base(l, a)
    
    l -= 1
    print(sum([l % a for a in A]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 5332
#include <iostream>

int main() {

    int i = 1;
    int n, x;
    std::cin >> n;

    do {
        x = i;
        if (x % 3 == 0) {
            std::cout << " " << i;
            continue;
        }
        for (x; x != 0; x /= 10) {
            if (x % 10 == 3) {
                std::cout << " " << i;
                break;
            }
        }
    } while (++i <= n);
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	//N = 200000;
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		//A[i] = 32;
	}
	sort(A.begin(), A.end());
	vector<int> V(N, 0);
	for (int i = 32; i >= 0; i--) {
		int k = ((int)1 << i);
		int r = N - 1;
		for (int l = 0; l < N; l++) {
			if (V[l] == 1)continue;
	
			while (l < r && (A[l] + A[r] > k || V[r] == 1)) r--;
			if (l < r && A[l] + A[r] == k && V[r] == 0) {
				V[l] = 1;
				V[r] = 1;
				res++;
			}
			if (l >= r)break;
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    void print(vector<int> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    void print(vector<vector<int> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};

//--global--//



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

vector<pair<char, int> > Ranlength(string str){
    vector<pair<char, int> > ranlength;

    pair<char, int> f;
    char lastChar;
    int cnt = 0;
    rep(i, str.size()){
        if(lastChar != str[i] || i == str.size()){
            if(i!=0){
                f = make_pair(lastChar, cnt);
                ranlength.push_back(f);
            }
            lastChar = str[i];
            cnt=1;
        }
        else{
            cnt++;
        }
    }
    f = make_pair(lastChar, cnt);
    ranlength.push_back(f);

    // rep(i, ranlength.size()){ // for debug
    //     cout << ranlength[i].first << ranlength[i].second << endl;
    // }
    return ranlength;
}

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int n, k;
    cin >> n >> k;
    string str;
    cin >> str;
    vector<pair<char, int> > v;
    v = Ranlength(str);
    if(str[0] != '1'){
        v.insert(v.begin(), make_pair(1, 0));
    }
    if(*str.end() != '1'){
        v.insert(v.end(), make_pair(1, 0));
    }
    
    int zeroNum = 0;
    for(pair<char, int> f : v){
        char ch = f.first;
        if(ch == '0'){
            zeroNum++;
        }
    }

    int cnt = max(0, zeroNum - k) + 1;

    // cout << cnt << endl;

    int ans = 0;
    rep(i, cnt){
        int start = i * 2;
        int end = min(k, zeroNum) * 2 + 1;
        int tmp = 0;
        rep(j, end){
            tmp += v[j + start].second;
        }
        ans = max(ans, tmp);
    }

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


Measured memory_bytes: 1656
#include<iostream>
#include<vector>
#include<string>
#define Int long long
using namespace std;
int main(){
    int q;
    cin>>q;
    vector<Int> a;
    int j,x,p;
    for(int i=0;i<q;i++){
        cin>>j;
        if(j==0){
            cin>>x;
            a.push_back(x);
        }
        else if(j==1){
            cin>>p;
            cout<<a[p]<<endl;
        }
        else if(j==2){
            a.pop_back();
        }
    }
    return 0;
}



Measured memory_bytes: 4968
n = int(input())
p = [x for x in map(int, input().split())]

memo = []

for i in range(1, n):
    if p[i - 1] > p[i]:
        memo.append(i)

flag = True

if len(memo) >= 3:
    flag = False
elif len(memo) == 0:
    flag = True
elif len(memo) == 1:
    pp = p
    pp[memo[0] - 1], pp[memo[0]] = pp[memo[0]], pp[memo[0] - 1]
    for i in range(1, n):
        if pp[i - 1] > pp[i]:
            flag = False
            break
elif len(memo) == 2:
    pp = p
    pp[memo[0] - 1], pp[memo[1]] = pp[memo[1]], pp[memo[0] - 1]
    for i in range(1, n):
        if pp[i - 1] > pp[i]:
            flag = False
            break

print('YES') if flag else print('NO')


Measured memory_bytes: 3064
package main

import (
	"fmt"
	"math"
)

var N, X, D int
var ans int = 1

func main() {
	fmt.Scan(&N, &X)

	L := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scan(&L[i])
	}

	for _, value := range L {
		D = D + value
		if D <= X {
			ans++
		}
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}
type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b, c; scanf("%d %d %d", &a, &b, &c);
	
	int mi = 1 << 30;
	mi = std::min(mi, std::abs(a - b) + std::abs(b - c));
	mi = std::min(mi, std::abs(b - c) + std::abs(c - a));
	mi = std::min(mi, std::abs(c - a) + std::abs(a - b));
	printf("%d\n", mi);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    string s;
    cin >> s;
    int n = s.size();

    int ans = 0;
    char c[] = {'A', 'T', 'C', 'G'};
    rep(i, n){
        for(int j=i; j<n; j++){
            bool ok = true;
            for(int k=i; k<=j; k++){
                bool flag = false;
                rep(l, 4){
                    if(s[k] == c[l]) flag = true;
                }
                if(!flag) ok = false;
            }
            if(ok) chmax(ans, j-i+1);
        }
    }

    cout << ans << endl;
}

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

void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}

int main() {
  string n;
  cin >> n;
  for(int i = 0; i < n.size(); i++) {
    if (n[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<string> a(n);
    rep(i,n){
        string m;
        cin >> m;
        sort(m.begin(),m.end());
        a[i]=m;
    }
    sort(a.begin(),a.end());
    ll cnt = 1;
    ll ans = 0;
    rep(i,n-1){
        if(a[i]==a[i+1]){
            cnt++;
            // cout << cnt << endl;
        }
        else{
            // cout << cnt << " " << i << endl;
            ans += cnt*(cnt-1)/2;
            cnt = 1;
        }
    }
    ans += cnt*(cnt-1)/2;
    cout << ans;

    return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, k, a[100000], b[100000];

LL f(int p) {
	LL sum = 0;
	inc(i, n) {
		if((p == 0 || ((a[i] >> p) & 1) == 0) && ((a[i] >> p) | (k >> p)) == (k >> p)) { sum += b[i]; }
	}
	return sum;
}

int main() {
	cin >> n >> k;
	inc(i, n) { cin >> a[i] >> b[i]; }
	
	LL ans = 0;
	inc(bit, 30) {
		if(((k >> bit) & 1) || bit == 0) { setmax(ans, f(bit)); }
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
d=[0]*13
d[0]=1
for c in input():
	e=[0]*13
	for k in(range(10)if c>'>'else[int(c)]):
		for j in range(13):t=(j*10+k)%13;e[t]+=d[j];e[t]%=10**9+7
	d=e
print(d[5])

Measured memory_bytes: 42604
import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, k) = in.readLine.split(" ").map(_.toLong)

  val ans = 
    if (k == 0) n * n
    else (k+1 to n)./:(0L)( (acc, i) => {
      val p = n / i
      val r = n % i
      acc + (i-k) * p + ((r - k + 1) max 0)
    })
  println(ans)
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int know_digit(ll n)
{
    int ans = 0;
    while(n){
        n /= 10;
        ++ans;
    }
    return ans;
}

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    vector<ll> p(m);
    vector<ll> y(m);
    vector<vector<ll>> city(n);
    for(i = 0;i < m;++i){
        cin >> p.at(i) >> y.at(i);
        --p.at(i);
        city.at(p.at(i)).push_back(y.at(i));
    }
    for(i = 0;i < n;++i){
        sort(all(city.at(i)));
    }
    for(i = 0;i < m;++i){
        ll num = lower_bound(all(city.at(p.at(i))), y.at(i)) - city.at(p.at(i)).begin();
        ll digit = know_digit(p.at(i)+1);
        rep(j, 6 - digit) cout << 0;
        cout << p.at(i)+1;
        digit = know_digit(num+1);
        rep(j, 6 - digit) cout << 0;
        cout << num+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 8576
def B():
    def odd(x):
        return int(3 * x + 1)
    
    def even(x):
        return int(x / 2)

    def is_unique(seq):
        return len(seq) == len(set(seq))

    s = int(input())

    a_list = []
    a_list.append(s)
    
    for i in range(1000000):
        ai = a_list[i]

        if ai % 2 == 0:
            a_list.append(even(ai))
        else:
            a_list.append(odd(ai))

        if is_unique(a_list) is not  True:
            # (i + 1) + 1
            print(i + 1 + 1)
            break
    

if __name__== '__main__':
    B()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
int N;
string S;
cin >> N >> S;
string S_1;
string S_2;
int a = 0;
for(int i = 0; i < N; i++){
    S_1 = S.substr(0,i);
    S_2 = S.substr(i);
    
    int cnt = 0;
    for(char j = 'a'; j <= 'z'; j++){
        
        if(S_1.find(j) != -1 && S_2.find(j) != -1)cnt++;
    }
    a = max(a,cnt);
}
cout <<  a << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
typedef long long ll;
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define Rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
#define Eep(i , u , v) for(int i = Head[u] , v = Node[i] ; i ; v = Node[i = Next[i]])
using namespace std;

const int N = 100000 + 7 , M = 16;
int n , tot[M] , Dp[(1 << 16) + 7] , W[N] , Sum[N];

int main() {
	int u , v , w , S = 0 , Ret = 0;
	scanf("%d" , &n);
	Rep(i , 2 , n) scanf("%d%d%d" , &u , &v , &w) , W[u + 1] ^= w , W[v + 1] ^= w;
	Rep(i , 1 , n) inc(tot[W[i]]);
	Rep(i , 1 , 15) Ret += tot[i] / 2 , S |= (tot[i] & 1) << i;
	Rep(i , 1 , (1 << 16) - 1) Dp[i] = Dp[i >> 1] + (i & 1);
	Rep(i , 1 , (1 << 16) - 1) Dp[i] -= 1;
	Rep(i , 1 , (1 << 16) - 1)
		Rep(j , 0 , 15) if((i >> j) & 1) Sum[i] ^= j;
	Rep(i , 1 , (1 << 16) - 1) if(!Sum[i]) {
		for(int k = i & (i - 1) ; k ; k = (k - 1) & i)
			if(!Sum[k]) Dp[i] = min(Dp[i] , Dp[i ^ k] + Dp[k]);
	}
	printf("%d" , Ret + Dp[S]);
	return 0;
}

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

namespace AtCoderabc153
{
    class Program
    {
        static void Main(string[] args)
        {

            var line1 = Console.ReadLine().Split(' ');
            var hp = int.Parse(line1[0]);
            //var attCount = int.Parse(line1[1]);

            var line2 = Console.ReadLine().Split(' ');
            var tmp = new List<int>();
            foreach(var lines  in line2) { tmp.Add(int.Parse(lines)); }
            Console.WriteLine(hp <= tmp.Sum() ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 18400
import java.util.Scanner;

public class Main
{

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

		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		int hl = Integer.parseInt(sc.next());
		int wl = Integer.parseInt(sc.next());

		System.out.println((h - hl) * (w - wl));
		sc.close();
	}
}

Measured memory_bytes: 23124
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

h,n=MI()
lis=[LI() for i in range(n)]
mx=sorted(lis,reverse=True)[0][0]
#print(mx)
dp=[0 for i in range(h+mx)]
for i in range(1,h+mx):
    mn=inf
    #print(i,i)
    for j in range(n):
        u=dp[max(i-lis[j][0],0)]+lis[j][1]
        #print(u)
        if u<mn:
            mn=u
    dp[i]=mn
#print(dp)
z=[]
for i in range(mx):
    z.append(dp[h+i])
print(min(z))

Measured memory_bytes: 42588
#include <stdio.h>

int main(void){
int A;
int a;
int b;
int c;
int n;
int x=0;
scanf("%d%d%d",&a,&b,&c);
for(n=a;n<=b;n++){
A=c%n;
if(A==0){
x = x + 1;}}
printf("%d\n",x);}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#include <algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main(){
  int n, k, r, s, p;
  string t; //r,s,p
  int ans=0;
  cin >> n >> k >> r >> s >> p >> t;
  vector <bool> won(n, false);

  for(int i=0; i<n; i++){
    if(i<k || t[i-k] != t[i] || !won[i-k]){ //k回前に勝っていなければ勝つ手を出せる
      if('r' == t[i]){
        ans += p; //パーを出す
      }
      if('s' == t[i]){
        ans += r; //グーを出す
      }
      if('p' == t[i]){
        ans += s; //チョキを出す
      }
      won[i] = true;
    }
  }
  cout << ans;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int N;

void func(){

	int minimum = BIG_NUM,num_a,num_b,num_c,tmp;

	for(int a = 0; a <= N; a += 200){
		for(int b = 0; b <= N; b += 300){
			if(a+b > N)break;
			for(int c = 0; c <= N; c += 500){
				if(a+b+c > N)break;

				if(a+b+c == N){
					num_a = a/200;
					num_b = b/300;
					num_c = c/500;
					tmp = 380*(num_a%5)+550*(num_b%4)+850*(num_c%3)+304*(num_a - num_a%5)+1870*(num_b-num_b%4)/4+748*(num_c-num_c%3);
					minimum = min(minimum,tmp);
				}
			}
		}
	}
	printf("%d\n",minimum);

}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 2732
import heapq

S = input().split(" ")
N = int(S[0])
M = int(S[1])
S = input()

arr = [-int(s) for s in S.split(" ")]

heapq.heapify(arr)

for i in range(M):
    maxValue = -heapq.heappop(arr)
    heapq.heappush(arr,-(maxValue//2))

print(-sum(arr))



Measured memory_bytes: 15228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(a,j,n) for(ll i=a;i<j;i=i+n )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 1000000009;
ll i;
vector<string> a={"a","b","c","d","e","f","g","h","i","j","k","l"};
typedef pair<string,int> S;
int main(){
    int N;
    cin>>N;
    vector<pair<string,int>> ans;
    
    for(ll j=0;j<N;j++){
        if(j==0)ans.push_back(S("a",0));
        else{
            int size=ans.size();
            for(ll k=0;k<size;k++){
                if(ans.at(k).second+1==j){
                    for(int x=0;x<j;x++){
                        ans.push_back(S(ans.at(k).first+a.at(x),j-1));
                    }
                    ans.push_back(S(ans.at(k).first+a.at(j),j));
                }
                else{
                    for(int y=0;y<ans.at(k).second+1;y++){
                        ans.push_back(S(ans.at(k).first+a.at(y),ans.at(k).second));
                    }
                    ans.push_back(S(ans.at(k).first+a.at(ans.at(k).second+1),ans.at(k).second+1));
                }
            }
            ans.erase(ans.begin(),ans.begin()+size);
        }
    }
    vector<string> realans;
    for(int w=0;w<ans.size();w++)realans.push_back(ans.at(w).first);
    sort(realans.begin(),realans.end());
    for(string h:realans)cout<<h<<endl;
}



Measured memory_bytes: 12524
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import Counter
import itertools

H,W,N = map(int,readline().split())
m = map(int,read().split())
AB = list(zip(m,m))

AB = [(x+dx,y) for x,y in AB for dx in [0,1,2] if 3 <= x+dx <= H]
AB = [(x,y+dy) for x,y in AB for dy in [0,1,2] if 3 <= y+dy <= W]

answer = [0] * 10
for x,y in Counter(Counter(AB).values()).items():
    answer[x] = y

answer[0] = (H-2) * (W-2) - sum(answer)
print('\n'.join(map(str,answer)))

Measured memory_bytes: 205972
#include<bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    int N,K;cin>>N>>K;
    int X,Y;cin>>X>>Y;

    if(K>=N) cout<<N*X<<endl;
    else cout<<K*X+(N-K)*Y<<endl;
}



Measured memory_bytes: 256
/*
[abc141] E - Who Says a Pun?
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 5e3;

int N;
string S;
int dp[MAX_N][MAX_N];

ll solve() {
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            dp[i][j] = S[i] == S[j] ? (i > 0 ? dp[i - 1][j - 1] : 0) + 1 : 0;
            if (i + dp[i][j] <= j) {
                ans = max(ans, dp[i][j]);
            }
        }
    }

    return ans;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 96896
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
 
int main(){
  ll n, a, b;
  cin >> n >> a >> b;

  ll ans = 0;
  ll cnt = n / (a+b);
  ans += cnt * a;

  ll amari = n % (a+b);
  if(amari > a) ans += a;
  else ans += amari;

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

Measured memory_bytes: 256
def gcd(a,b)
  if b == 0
    a
  else
    gcd(b,a%b)
  end
end
def lcm(a,b)
  a*b/gcd(a,b)
end
a,b,c,d = gets.chomp.split(" ").map(&:to_i)
sum = b-a+1
sum_c = b/c - (a-1)/c
sum_d = b/d - (a-1)/d
e = lcm(c,d)
sum_e = b/e - (a-1)/e
puts sum - sum_c - sum_d + sum_e

Measured memory_bytes: 14288
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

const int MXN = 3005;
int t[MXN];
int s;

LL res = 0;


int mod = 998244353;
int ple[2][MXN][MXN];


void clear(int r, int idx)
  {
  FOR(i, 0, s)ple[r][idx][i] = 0;
  ple[r][idx][0] = 1;
  }

void add(int r, int idx, int val, int off)
  {
  FOR(i, 0, s)ple[r][idx][i] = ple[r][idx+off][i];

  FORD(i, s, val)
    {
    ple[r][idx][i] += ple[r][idx][i-val];
    if(ple[r][idx][i] >= mod)ple[r][idx][i] -= mod;
    }
  }

LL sum_1[MXN];
LL sum_2[MXN];


void go(int a, int b)
  {
  if(a == b)
    {
    if(t[a] == s)res += 1;
    return;
    }
  if(a > b)return;

  int mid = (a + b) / 2;
  // a .. mid w lewej
  // mid+1 .. b w prawej

  clear(1, mid);
  FOR(i, mid+1, b)
    {
    add(1, i, t[i], -1);
    }

  clear(0, mid+1);
  FORD(i, mid, a)
    {
    add(0, i, t[i], 1);
    }

  FOR(i, 0, s)sum_1[i] = sum_2[i] = 0;

  FOR(i, a, mid)
    {
    FOR(su, 0, s)sum_1[su] += ple[0][i][su];
    }
  FOR(j, mid+1, b)
    {
    FOR(su, 0, s)sum_2[su] += ple[1][j][su];
    }
  FOR(i, 0, s)
    {
    sum_1[i] %= mod;
    sum_2[i] %= mod;
    }

  FOR(par_s, 0, s)
    res += (LL)sum_1[par_s] * sum_2[s - par_s] % mod;
  res %= mod;

  go(a, mid);
  go(mid+1, b);

  }

int main()
{
  int n;
  scanf("%d%d", &n, &s);
//  n = s = 3000;
  FOR(i, 1, n)
    {
    scanf("%d", &t[i]);
//    t[i] = 1;
    }

  go(1, n);
  res %= mod;
  cout << res << endl;
}


Measured memory_bytes: 70784
# INPUT
first_word = input()
second_word = input()

# # PROCESS
answer = "No"
answer_dict = {}
answer_dict2 = {}

def check_dict(dic, val_word, check_word):
  answer_bool = True
  for i in range(len(val_word)):
    if (val_word[i] in dic.keys()):
      if (dic[val_word[i]] != check_word[i]):
        answer_bool = False
        break
    else:
      dic[val_word[i]] = check_word[i]

  return answer_bool

check_1 = check_dict(answer_dict, first_word, second_word)
check_2 = check_dict(answer_dict2, second_word, first_word)
if (check_1 and check_2):
  answer = "Yes"

# OUTPUT
print(answer)

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>

using namespace std;

const int mod = 1'000'000'007;

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int mul(int a, int b) {
  return (int)((long long)a * b % mod);
}

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

int get(int b) {
  int res = pw(10, b);
  add(res, mod - pw(10, b - 1));
  return res;
}

int main() {
  int s;
  scanf("%d", &s);
  int ans = 0;
  for (int i = 1; i * i <= s; ++i) {
    if (s % i == 0) {
      {
        int cnt = get(i);
        if (i >= 9 || cnt >= s / i) {
          add(ans, cnt);
          add(ans, mod - s / i + 1);
        }
      }
      if (s / i != i) {
        int cnt = get(s / i);
        if (s / i >= 9 || cnt >= i) {
          add(ans, cnt);
          add(ans, mod - i + 1);
        }
      }
    }
  }
  for (int i = 1; i <= 8; ++i) {
    long long v = 0;
    for (int j = i + 1; j <= 9; ++j) {
      for (int k = 1; k <= get(i); ++k) {
        if (v + i * k >= s) {
          break;
        }
        if ((s - v - i * k) % j == 0 && (s - v - i * k) / j <= get(j)) {
          add(ans, 1);
        }
      }
      v += j * get(j);
      if (v >= s) {
        break;
      }
    }
  }
  for (int i = 9; i * i < s; ++i) {
    int v = s / (i + 1);
    if (s % (i + 1) == 0) {
      --v;
    }
    int r = s % i;
    if (v >= r) {
      add(ans, (v - r) / i);
    }
  }
  for (int i = 9; i <= s / 2; ++i) {
    int v = s / (i + 1);
    if (s % (i + 1) == 0) {
      --v;
    }
    int r = s % i;
    if (v >= r) {
      add(ans, r != 0);
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<tuple>
#include<sstream>
#include<functional>
#include<list>
#include<queue>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
typedef pair<ll, ll> p;
typedef vector<int> vec;
using Graph = vector<vector<int>>;
using graph = vector<vector<ll>>;

const int inf = 1e9+7;
const long long MOD = 1000000007;

// ローリングハッシュ
// 二分探索で LCP を求める機能つき
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string& S) {
        int n = (int)S.size();
        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        power1.assign(n + 1, 1);
        power2.assign(n + 1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i + 1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i + 1] = (power1[i] * base1) % mod1;
            power2[i + 1] = (power2[i] * base2) % mod2;
        }
    }

    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r - l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r - l] % mod2;
        if (res2 < 0) res2 += mod2;
        return { res1, res2 };
    }
};


int main() {
    int n;
    string str;
    cin >>n>> str;
    RollingHash rh(str);
    auto check = [&](int d) {
        map<p, int> ma;
        for (int i = 0; i + d <= n; i++) {
            if (ma.count(rh.get(i, i + d))) {
                if (i >= ma[rh.get(i, i + d)] + d)return true;
            }
            else ma[rh.get(i, i + d)] = i;
        }
        return false;
    };
    int left = 0; int right = (n / 2) + 1;
    while (right - left > 1) {
        int mid = (left + right) / 2;
        if (check(mid))left = mid;
        else right = mid;
    }
    cout << left << endl;
    return 0;
}

Measured memory_bytes: 3656
n,p = map(int,input().split(" "))

l = input().split(" ")
s = 0
for  i in l:
  m = int(i)
  s = s + m
 
q = s/(4*p)

c = 0
for i in l:
  m = int(i)
  if m >= q:
    c = c + 1
if c >= p:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9096
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>
#include <queue>
#include <stack>

using namespace std;


int main() {
	double r;
	cin >> r;
	cout << 2 * r * 3.14 << endl;

	return 0;
}


Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define ULL unsigned long long


int main() {
	int n, k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	ULL score = 0;
	for (int i = 0; i < k; i++) {
		char bef = ' ';
		for (int j = i; j < n; j += k) {
			if (bef != ' ' && t[j - k] == t[j]) {
				bef = ' ';
				continue;
			}
			if (t[j] == 'r') {
				bef = 'p';
				score += p;
			}
			else if (t[j] == 's') {
				bef = 'r';
				score += r;
			}
			else {
				bef = 's';
				score += s;
			}
		}
	}
	cout << score;
}

Measured memory_bytes: 512
H,W,M = map(int,input().split())
Bomb = []
H_num = [0 for _ in range(H)]
W_num = [0 for _ in range(W)]
for i in range(M):
  a,b = map(int,input().split())
  a-=1;b-=1
  Bomb.append([a,b])
  H_num[a] += 1
  W_num[b] += 1

HMAX = max(H_num);WMAX = max(W_num)
ans = HMAX+WMAX
HMAX_list = set([]); WMAX_list = set([])
for i in range(H):
  if H_num[i] == HMAX:
    HMAX_list.add(i)
for i in range(W):
  if W_num[i] == WMAX:
    WMAX_list.add(i)
kosu = len(HMAX_list)*len(WMAX_list)
cnt = 0
for z in Bomb:
  x = z[0];y = z[1]
  if x in HMAX_list and y in WMAX_list:
    cnt += 1
#print(kosu,cnt)
if cnt < kosu:
  print(ans)
else:
  print(ans-1)

Measured memory_bytes: 216388
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace AtCoder.ARC079
{
    class CatSnukeAndAVoyage
    {
        public static void Main()
        {
            var nm = ReadLine().Trim().Split(' ').Select(_ => int.Parse(_));
            var n = nm.First(); var m = nm.Last();
            var lands = new int[n];
            foreach(var bridge in (new int[m]).Select(_ => ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).OrderBy(num => num))) {
                if (bridge.First() == 1) lands[bridge.Last()] += 1;
                if (bridge.Last() == n) lands[bridge.First()] += n;
            }
            var possible = "POSSIBLE";
            var impossible = "IMPOSSIBLE";
            if (lands.Any(_ => _ == n + 1)) WriteLine(possible);
            else WriteLine(impossible);
        }

    }
}


Measured memory_bytes: 19048
#include <bits/stdc++.h>
#include <string.h>
//#include <queue>
using namespace std;
#define ll long long
#define ld long double

int main()
{
    int a,b;
    cin >> a >> b;
    if (a>=13) cout << b; else
        if (a<=5) cout << 0; else
        cout << b/2;
    return(0);
}


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

namespace CF2016B_B
{
    class Program
    {
        static int N, A, B;
        static int a, b;
        static void Main(string[] args)
        {
            var t = scan;
            N = t[0]; A = t[1]; B = t[2];
            var S = ReadLine();
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'a')
                {
                    if(a + b < A + B)
                    {
                        a++;
                        Console.WriteLine("Yes");
                    }
                    else
                    {
                        Console.WriteLine("No");
                    }
                }
                else if(S[i] == 'b')
                {
                    if(a +b < A + B && b < B)
                    {
                        b++;
                        Console.WriteLine("Yes");
                    }
                    else
                    {
                        Console.WriteLine("No");
                    }
                }
                else Console.WriteLine("No");
            }
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
#define pp pair<int,int> 
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順
 
int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  sort(l.begin(), l.end());
  int M=l[n-1];
  int sum=0;
  rep(i,n-1) sum+=l[i];
  if(M<sum) cout << "Yes" << endl;
  else cout << "No" << endl;
  }    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<string> w = {s};
  for(int i = 0;i < n - 1;i++) {
    cin >> s;
    if(s.at(0) != w.at(i).at(w.at(i).size() - 1)) {
      cout << "No" << endl;
      return 0;
    }
    for(int j = 0;j < w.size();j++) {
      if(s == w.at(j)) {
        cout << "No" << endl;
        return 0;
      }
    }
    w.push_back(s);
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	static char[][] map = new char[8][8];
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		for(int i = 0; i < 8; i++) {
			String tmp = stdIn.next();
			for(int j = 0; j < 8; j++) {
				map[i][j] = tmp.charAt(j);
			}
		}
		
		while(true) {
			boolean M = cC();
			boolean C = cM();

			
			if(!M && !C) {
				break;
			}
		}
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				System.out.print(map[i][j]);
			}
			System.out.println();
		}
	}
	static int[] xv = {1 ,0 ,-1,0 ,1 ,1 ,-1,-1};
	static int[] yv = {0 ,1 ,0 ,-1,1 ,-1,1 ,-1};
	public static boolean cM() {
		int max = 0;
		int maxX = 0;
		int maxY = 0;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(map[i][j] != '.') {
					continue;
				}
				int NM = 0;
				for(int k = 0; k < 8; k++) {
					for(int l = 1; l < 10; l++) {
						int x = j + xv[k]*l;
						int y = i + yv[k]*l;
						if(x < 0 || y < 0 || x > 7 || y > 7) break;
						if(map[y][x] == '.') {
							break;
						}
						if(map[y][x] == 'x') {
							NM += (l-1);
							break;
						}
					}
				}
				//ch
				if(NM > max) {
					max = NM;
					maxX = j;
					maxY = i;
				}
				else if(NM == max) {
					if(maxY < i) {
						maxY = i;
						maxX = j;
					}
					else if(maxY == i && maxX < j) {
						maxX = j;
					}
				}
			}
		}
		
		if(max == 0) {
			return false;
		}
		for(int k = 0; k < 8; k++) {
			IN:for(int l = 1; l < 10; l++) {
				int x = maxX + xv[k]*l;
				int y = maxY + yv[k]*l;
				if(x < 0 || y < 0 || x > 7 || y > 7) break;
				if(map[y][x] == '.') {
					break IN;
				}
				if(map[y][x] == 'x') {
					for(int m = 0; m < l; m++) {
						map[maxY + yv[k]*m][maxX + xv[k]*m] = 'x';
					}
					break IN;
				}
			}
		}
		return true;
	}
	public static boolean cC() {
		int max = 0;
		int maxX = 0;
		int maxY = 0;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(map[i][j] != '.') {
					continue;
				}
				int NM = 0;
				for(int k = 0; k < 8; k++) {
					for(int l = 1; l < 10; l++) {
						int x = j + xv[k]*l;
						int y = i + yv[k]*l;
						if(x < 0 || y < 0 || x > 7 || y > 7) break;
						if(map[y][x] == '.') {
							break;
						}
						if(map[y][x] == 'o') {
							NM += (l-1);
							break;
						}
					}
				}
				if(NM > max) {
					max = NM;
					maxX = j;
					maxY = i;
				}
				else if(NM == max) {
					if(maxY > i) {
						maxY = i;
						maxX = j;
					}
					else if(maxY == i && maxX > j) {
						maxX = j;
					}
				}
			}
		}
		
		if(max == 0) {
			return false;
		}
		for(int k = 0; k < 8; k++) {
			IN:for(int l = 1; l < 10; l++) {
				int x = maxX + xv[k]*l;
				int y = maxY + yv[k]*l;
				if(x < 0 || y < 0 || x > 7 || y > 7) break;
				if(map[y][x] == '.' ) {
					break IN;
				}
				if(map[y][x] == 'o') {
					for(int m = 0; m < l; m++) {
						map[maxY + yv[k]*m][maxX + xv[k]*m] = 'o';
					}
					break IN;
				}
			}
		}
		return true;
	}
}

Measured memory_bytes: 18212
a, b = map(int, input().split())
result = -1
if a in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    if b in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
        result = a*b
print(result)


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

using namespace std;

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

  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    int d;
    scanf("%d", &d);
    v[i] = d;
  }

  int c = 0;
  bool bump = false;
  int l = 0, r = 0;
  for (int i = 0; i < n-1; i++) {
    if (c > 2) {
      cout << "NO" << endl;
      return 0;
    }
    if (!bump) {
      if (v[i] != i + 1) {
        bump = true;
        l = i;
        c++;
      }
    } else {
      if (v[i] != i + 1) {
        r = i;
        if (v[l] != r + 1 || v[r] != l + 1) {
          cout << "NO" << endl;
          return 0;
        }
      }
    }
  }

  cout << "YES" << endl;
  
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  char C; cin >> C;
  char result = C + 1;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256