akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){

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

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

    int count=1;
    int d=0;

    for(int i=0;i<n;i++){
        
        d+=L[i];
        if(d>x)break;
        count++;
    }
    printf("%d\n",count);

    return 0;
}

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

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	vector<vector<int>> is(26);
	rep(i, n) is[s[i] - 'a'].emplace_back(i);
	rep(i, n) is[s[i] - 'a'].emplace_back(i + n);
	ll ans = 0;
	int p = 0;
	rep(i, m) {
		int c = t[i] - 'a';
		if (is[c].size() == 0) {
			cout << -1 << endl;
			return 0;
		}
		p = *lower_bound(is[c].begin(), is[c].end(), p) + 1;
		if (p >= n) {
			p -= n;
			ans += n;
		}
	}
	ans += p;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1724
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,sqrt
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()

n=I()
k=I()
ans=1
for i in range(n):
    ans=min(ans+k,2*ans)
print(ans)

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

using namespace std;

int main() {
  pair<pair<string, int>, int> p[120];

  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    string s;
    cin >> s;
    int point;
    cin >> point;
    p[i] = make_pair(make_pair(s, -point), i + 1);
  }
  sort(p, p + N);
  for (int j = 0; j < N; ++j) {
    cout << p[j].second << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
     
    int main(){
    char s[101];
    char t[101];
    char tmp;
    int i, j;
    scanf("%s",s);
    scanf("%s",t);
    for(i=0;i<(int)strlen(s)-1;i++){
    for(j=i+1;j<(int)strlen(s);j++){
    if(s[i] > s[j]){
    tmp = s[i];
    s[i] = s[j];
    s[j] = tmp;
    }
    }
    }
    for(i=0;i<(int)strlen(t)-1;i++){
    for(j=i+1;j<(int)strlen(t);j++){
    if(t[i] < t[j]){
    tmp = t[i];
    t[i] = t[j];
    t[j] = tmp;
    }
    }
    }
    if(strcmp(s,t)<0)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
    }


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;


namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            int C = int.Parse(s[2]);

            Console.WriteLine((C / A) * B);
        }
    }
}


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

/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	char c;
	cin>>c;
	if('a'<=c&&c<='z'){
		cout<<'a';
	}
	else if('A'<=c&&c<='Z'){
		cout<<'A';
	}


}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

string Long2Bin(ll n){
    if(n == 1)return "1";
    else if(n == 0)return "0";

    return Long2Bin(n/2)  + Long2Bin(n%2);
}

int main(){
    ll n;
    cin >> n;

    //プラスの部分だけ
    rep(bit, (1 << 16)){
        ll score = 0;
        rep(i, 16)if((1 << i) & bit){
            score += pow(2, 2*i);
        }

        //残りの数の符号を反転したもの
        ll score_mi = score - n;

        ll isok = true;
        rep(i, 32)if((1 << i) & score_mi){
            if(i&1)continue;

            //負の数の桁（奇数桁）でない値が必要ならダメ
            isok = false;
            break;
        }

        if(isok){
            cout << Long2Bin(score + score_mi) << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4092
#include<bits/stdc++.h>
using namespace std;
string st;
int z;
int main()
{
	cin>>st;
	for(int i=0;i<st.size();i++)
	{
		if(st[i]=='C')z++;
		if(z>0&&st[i]=='F')
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

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

int main() {
  string s;cin>>s;
  int ans=1e9;
  rep(i,2){
    int cnt=0;
    rep(j,s.size()){
      if(j%2==0&&s[j]!=(char)(i+'0'))cnt++;
      if(j%2==1&&s[j]==(char)(i+'0'))cnt++;
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}

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

int main(void){
    int N; cin >> N;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int a; cin >> a;
        while(true){
            if(a%2 == 0){
                ans++;
                a /= 2;
            }
            else break;
        }
    }
    cout << ans << endl;
}

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

// 子どもを表す構造体
struct infant{
  int position; // 位置
  int64_t lively;   // 活発度
  
  // 活発度が同じ場合、位置で判断する
  bool operator<( const infant &right ) const{
    return lively == right.lively ? position < right.position : lively < right.lively;
  }
  
};

int main(){
  
  int N = 0;
  std::cin >> N;
  
  std::vector< infant > vec_infants( N );
  for( int cnt = 0; cnt < N; cnt++ ){
    vec_infants.at( cnt ).position = cnt + 1;
    std::cin >> vec_infants.at( cnt ).lively;
  }
  
  // 活発度を基準に降順ソート
  sort( vec_infants.begin(), vec_infants.end() );
  reverse( vec_infants.begin(), vec_infants.end() ); 
  
  // dp[x][y]
  // x:左端に寄せた数 y:右端に寄せた数
  // x+y = N
  std::vector< std::vector< int64_t > > dp( N + 1, std::vector< int64_t >( N + 1, 0 ) );
  for( int i = 0; i < N; i++ ){
    for( int j = 0; j < N - i; j++ ){
      // 左端に寄せたとき
      int left_renge = std::abs( ( i + 1 ) - vec_infants.at( i + j ).position );
      if( dp.at( i + 1 ).at( j ) < dp.at( i ).at( j ) + vec_infants.at( i + j ).lively * left_renge ){
        dp.at( i + 1 ).at( j ) = dp.at( i ).at( j ) + vec_infants.at( i + j ).lively * left_renge;
      }
      // 右端に寄せたとき
      int right_renge = std::abs( ( N - j ) - vec_infants.at( i + j ).position );
      if( dp.at( i ).at( j + 1 ) < dp.at( i ).at( j ) + vec_infants.at( i + j ).lively * right_renge ){
        dp.at( i ).at( j + 1 ) = dp.at( i ).at( j ) + vec_infants.at( i + j ).lively * right_renge;
      }
      
    }
  }
  
  int64_t answer = 0;
  for(int i = 0; i <= N ;i++){
    for(int j = 0; j <= N; j++){
      answer = std::max( dp.at( i ).at( j ), answer );
    }
  }
  
  std::cout << answer << std::endl;
  
  return 0;
}


Measured memory_bytes: 34388
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  double x1,y1,x2,y2,x3,y3,x4,y4;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4) {
    if (x2>=x3&&x1<=x4&&y2>=y3&&y1<=y4)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N, K; cin >> N >> K;
	vector<int> num(K, 0);
	rep(i, 1, N + 1)num[i%K]++;
	lli ans = 0;
	rep(a, 0, K) {
		int b = (K - a) % K;
		int c = (K - a) % K;
		if ((b + c) % K == 0)ans += (lli)num[a] * num[b] * num[c];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 00:22:18 2020

@author: Kanaru Sato
"""

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

mot = 0.0
for i in range(n):
    mot += 1/a[i]
print(1/mot)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin >> n, n) {
    int table[7] = {0};
    REP(i,n) {
      int a;
      cin >> a;
      if (a < 60) {
        table[a/10]++;
      } else
        table[6]++;
    }
    REP(i,7)
      cout << table[i] << endl;
  }
}

Measured memory_bytes: 868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl;
    #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl;
    #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl;
    #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl;
#else
    #define p(x)
    #define p2(x,y)
    #define pp(x)
    #define pv(x)
    #define ppv(x)
#endif
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int maxp = 22;
const ld EPS = 1e-18;
const ll INF = 1e18;
const int MOD = 1e9+7;
const int N = 2e5+1;

template<typename T>
struct SEGTREE{
    struct node{
        T val; // for adding more stuff

        node() : val(0) {}
        node(T _val) : val(_val) {}
    };
    vector<node> seg;
    int N;

    void init(int n){
        N = n;
        seg.assign(4*n,node());
    }

    node merge(node x, node y){
        node res;
        res.val = max(x.val, y.val);
        return res;
    }

    void build(int s, int e, int idx, T arr[]){
        if(s == e){
            seg[idx] = node(arr[s]);
            return;
        }
        int mid = (s+e)/2;
        build(s,mid,idx*2,arr);
        build(mid+1,e,idx*2+1,arr);
        seg[idx] = merge(seg[idx*2],seg[idx*2+1]);
    }

    // supports 1-indexing
    void build(T arr[]){
        build(1,N,1,arr);
    }

    void update(int s, int e, int idx, int k, T val){
        if(s==e && s==k){
            seg[idx].val = max(seg[idx].val,val);
            return;
        }
        if(s>k || e<k)
            return;
        int mid = (s+e)/2;
        update(s,mid,idx*2,k,val);
        update(mid+1,e,idx*2+1,k,val);
        seg[idx] = merge(seg[idx*2],seg[idx*2+1]);
    }

    // arr[k] += val
    void update(int k, T val){
        update(1,N,1,k,val);
    }

    node query(int s, int e, int idx, int qs, int qe){
        if(qs<=s && e<=qe)
            return seg[idx];
        if(s>qe || e<qs)
            return node();
        int mid = (s+e)/2;
        return merge(query(s,mid,idx*2,qs,qe),query(mid+1,e,idx*2+1,qs,qe));
    }

    T query(int l, int r){
        return query(1,N,1,l,r).val;
    }

};

int main(){
fastio

int n,k;
cin>>n>>k;

int i,arr[n];

set<int> s;
for(i=0;i<n;i++){
    cin>>arr[i];
    s.insert(arr[i]);
}

SEGTREE<int> seg;
seg.init(n);

int dp[n],ans = 0;

int curr = 1;
map<int,int> mapper;
for(auto x : s)
    mapper[x] = curr++;




for(i=0;i<n;i++){
    int x = arr[i];
    int l = x-k;
    int r = x+k;
    auto it = s.lower_bound(l);
    l = *it;
    it = s.upper_bound(r);
    it--;
    r = *it;
    p2(l,r)
    l = mapper[l];
    r = mapper[r];
    dp[i] = seg.query(l,r)+1;
    seg.update(mapper[x],dp[i]);
    ans = max(ans,dp[i]);
}
cout<<ans<<endl;


}


Measured memory_bytes: 28008
import java.util.*;
import java.awt.geom.*;
public class Main {
	private void doit(){
		Scanner sc = new Scanner(System.in);
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		ArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>();
		while(sc.hasNext()){
			String s = sc.next();
			int num = sc.nextInt();
			if(map.containsKey(s)){
				int ind = map.get(s);
				list.get(ind).add(num);
			}
			else{
				list.add(new ArrayList<Integer>());
				list.get(list.size() - 1).add(num);
				map.put(s, list.size() - 1);
			}
		}
		
		ArrayList<String> list2 = new ArrayList<String>();
		for(String key: map.keySet()){
			list2.add(key);
		}
		Collections.sort(list2);
		for(int i = 0; i < list2.size(); i++){
			String key = list2.get(i);
			int ind = map.get(key);
			System.out.println(key);
			Collections.sort(list.get(ind));
			System.out.print(list.get(ind).get(0));
			for(int j = 1; j < list.get(ind).size(); j++){
				System.out.print(" " + list.get(ind).get(j));
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  size_t n;
  cin >> n;
  const size_t size = 3 * n;
  vector<int64_t> a(size);
  cin >> a;

  const int64_t inf = numeric_limits<int64_t>::max() >> 2;

  vector<int64_t> lhs(size, -inf), rhs(size, inf);

  {
    int64_t acc = 0;
    priority_queue<int64_t, vector<int64_t>, greater<int64_t>> heap;

    for(size_t i = 0; i < size; ++i)
    {
      acc += a[i];
      heap.push(a[i]);
      for(; n < heap.size(); heap.pop())
        acc -= heap.top();

      if(n < i + 2 && i + n < size)
        lhs[i] = acc;
    }
  }
  {
    int64_t acc = 0;
    priority_queue<int64_t, vector<int64_t>, less<int64_t>> heap;
    reverse(begin(a), end(a));

    for(size_t i = 0; i < size; ++i)
    {
      acc += a[i];
      heap.push(a[i]);
      for(; n < heap.size(); heap.pop())
        acc -= heap.top();

      if(n < i + 2 && i + n < size)
        rhs[i] = acc;
    }

    reverse(begin(rhs), end(rhs));
  }

  DEBUG(lhs);
  DEBUG(rhs);

  int64_t out = numeric_limits<int64_t>::min();
  for(size_t i = 0; i + 1 < lhs.size(); ++i)
    out = max(out, lhs[i] - rhs[i + 1]);

  cout << out;

  return EXIT_SUCCESS;
}



Measured memory_bytes: 9072
#include <iostream>
#include <string>

using namespace std;

int main(){
	int H;
	int W;

	cin >> H >> W;

	string words[H];

	for(int i = 0; i < H; i++){
		cin >> words[i];
	}

	for(int i = 0; i < W + 2; i++){
		cout << "#";
	}
	cout << endl;

	for(int i = 0; i < H; i++){
		cout << "#" << words[i] << "#" << endl;
	}

	for(int i = 0; i < W + 2; i++){
			cout << "#";
	}
	cout << endl;


	return 0;
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut iter = buf.split_whitespace();
    
    let k: usize = iter.next().unwrap().parse().unwrap();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    
    let mut bis: usize = 1;
    
    if k <= a || a+2 >= b {
        bis += k;
    } else {
        bis = b +  (b-a) * ((k-a-1)/2) + ((k-a-1)%2);
    }
    
    println!("{}", bis);
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  vi v(4);
  REP(i,4)cin>>v[i];
  sort(ALL(v));
  puts(v[0]==1 && v[1]==4 && v[2]==7 && v[3]==9 ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <string>

using namespace std;

int main() {
	string s; cin >> s;
	int ans = 0;
	for (int i = 1; i < s.size(); ++i) {
		if (s[i - 1] == s[i]) {
			if (s[i] == '0') s[i] = '1';
			else s[i] = '0';
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1<<29;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int n,W;
int w[101];
ll v[101];
ll dp[101][100001];

int main() {

	cin>>n>>W;

	rep(i,n){
		cin>>w[i]>>v[i];
	}
	rep(i,100001){
		dp[0][i]=0;
	}
	rep(i,n){
		rep(j,W+1){
			if(j>=w[i])dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
			else dp[i+1][j]=dp[i][j];
		}
	}
	cout<<dp[n][W]<<endl;
	return 0;
}


Measured memory_bytes: 79104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		boolean hantei =true;

		String[] wakeru = s.split("");
			for(int i=0;i<a;i++) {
			if(wakeru[i].equals("-")) {
				hantei=false;
			}
		}
		for(int i=a+1;i<a+b+1;i++) {

			if(wakeru[i].equals("-")) {
				hantei=false;
			}
		}
		if(!wakeru[a].equals("-")) {
			hantei=false;
		}


		if(hantei) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	}

}


Measured memory_bytes: 23764
#coding:utf-8
#桁の和を求めるので入力をint型のリストにする
n = list(map(int, list(input())))
#print(n)
#10のべき乗は答えは10
if n[0] == 1 and sum(n) == 1:
    print(10)
else:
    print(sum(n))

Measured memory_bytes: 2940
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>

const int N = 100000;
char a[N];
char b[N];
char c[N];
int main()
{
	scanf("%s",a);
	scanf("%s",b);
	scanf("%s",c);
	printf("%c%c%c\n",a[0],b[0],c[0]);
	return 0;
}


Measured memory_bytes: 128
loop do
    a,l = gets.split.map(&:to_i)
    break if a == 0 && l == 0
    aa = [a]
    i = j = ij = 0
    ans = 0
    loop do
        i += 1
        s = sprintf("%06d", a)[(6-l)...6]
        a = s.split(//).sort.reverse.join.to_i - s.split(//).sort.join.to_i
        if aa.include?(a)
            j = aa.index(a)
            ij = i - j
            ans = a
            break
        end
        aa.push(a)
    end
    puts "#{j} #{ans} #{ij}"
end

Measured memory_bytes: 6120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long
//cout << fixed << setprecision (10);   小数点以下１０桁まで

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

  if (b%a==0) {
  cout << a+b << endl;
  }
    else {
    cout <<b-a << endl;
    }
    
}



Measured memory_bytes: 256
import math
import itertools

N, K = map(int, input().strip().split())

all_combination = 0
for num in range(K, N + 2): # 選ぶ個数を1 から N + 1個までずらす
    min = (0 + num - 1) * num / 2
    max = (N - (num - 1) + N) * num / 2
    possiblility = (int(max) - int(min) + 1)
    all_combination += possiblility

print(all_combination % (1000000007))

Measured memory_bytes: 9224
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
A=Counter(A)
for i in range(Q):
    B, C = map(int, input().split())
    total=total-(A[B]*B)+(C*A[B])
    A[C] = A[C]+A[B]
    A[B]=0
    print(total)


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

int main(int argc, char const *argv[]) {
  string ring, word;
  cin >> ring >> word;
  ring += ring;

  if (ring.find(word) != string::npos) {
    cout << "Yes" << endl;
    return 0;
  }

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

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

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll; 
typedef long double ld; 
typedef vector<int> vi; 
typedef pair<int,int> pii; 
#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }
const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
const int mod=1000*1000*1000+7;  

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

void solve(){
  ll n; cin>>n; 
  if(n%2){
    cout<<0<<endl; 
  } 
  else {
    n/=2; 
    ll ans=0; 
    ll cur=5; 
    while(cur<=n){
      ans+=n/cur;  
      cur*=5; 
    }
    cout<<ans<<endl ;
  }
}

int main(){
	// clock_t beg=clock(); 
  fast_io; 
  int testcases=1; 
  // cin>>testcases; 
  cout << fixed << setprecision(13); 
  while(testcases--){
    solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}


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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int64_t> H(N);
  for(int i=0; i<N; i++){
    cin>>H.at(i);
  }
  sort(H.begin(),H.end());
  reverse(H.begin(),H.end());
   int64_t ans = 0;
  if(K<N){
    vector<int> I(N-K);
    for(int i = 0; i<N-K; i++){
      I.at(i) = H.at(K+i);
    }
    for(int j=0; j<I.size();j++){
      ans += I.at(j);
    }
  }
  cout << ans <<endl;
}

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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 4000;
const int mo = 998244353;

int C[N + 5][N + 5];

void init() {
    for(int i = 0; i <= N; ++i) {
        C[i][0] = C[i][i] = 1;
        for(int j = 1; j < i; ++j) {
            C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mo;
        }
    }
}

int k, n;
int solve(int x) {
    int tot = 0;
    for(int i = 1; i <= k; ++i) if(x >= i && (x - i) <= k) {
        ++ tot;
    }

    int ans = 0;
    if(x % 2 == 0) {
        -- tot;
        tot /= 2;
        for(int i = 0, pw = 1; i <= tot; ++i, pw = pw * 2 % mo) {
            ans = (ans + (ll) pw * C[tot][i] % mo * C[n+k-2*tot-2][k-2*tot+i-2]) % mo;
            ans = (ans + (ll) pw * C[tot][i] % mo * C[n+k-2*tot-3][k-2*tot+i-2]) % mo;
        }
    } else {
        tot /= 2;
        for(int i = 0, pw = 1; i <= tot; ++i, pw = pw * 2 % mo) {
            ans = (ans + (ll) pw * C[tot][i] % mo * C[n+k-2*tot-1][k-2*tot+i-1]) % mo;
        }
    }
    return ans;
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    init();
    read(k), read(n);
    for(int i = 2; i <= 2*k; ++i) {
        printf("%d\n", solve(i));
    }

    return 0;
}


Measured memory_bytes: 61440
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

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

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll mul(ll a, ll b, ll md){
	return a*b % md;
}
int n, m, x;
vector<int> price(15);
vector<vector<int>> vec(15, vector<int>(15));
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin>>n>>m>>x;
	for(int i = 0; i < n; i++){
		cin>>price[i];
		for(int j = 0; j < m; j++){
			cin>>vec[i][j];
		}
	}
	int ans = 1e9;
	for(int i = 0; i < (1<<n); i++){
		vector<int> tmp(15, 0);
		int pr = 0;
		for(int j = 0; j < n; j++){
			if((i>>j) & 1){
				pr += price[j];
				for(int u = 0; u < m; u++){
					tmp[u] += vec[j][u];
				}
			}
		}
		bool check = true;
		for(int u = 0; u < m; u++){
			if(tmp[u] < x){
				check = false;
				break;
			}
		}
		if(check){
			ans = min(ans, pr);
		}
	}
	if(ans == 1e9) cout<<-1;
	else cout<<ans<<endl;
}

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

using namespace std;

int n;
int a[16][16];
long long dp[1 << 16];

int GetBit(int num, int pos)
{
    return (num >> pos) & 1;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> a[i][j];
        }
    }
    int m = (1 << n) - 1;
    for (int i = 1; i <= m; i++)
    {
        dp[i] = 0;
        for (int j = 0; j < n; j++)
        {
            if (GetBit(i, j))
            {
                for (int k = j + 1; k < n; k++)
                {
                    if (GetBit(i, k))
                    {
                        dp[i] += a[j][k];
                    }
                }
            }
        }
        int t = m / 2;
        for (int j = 1; j <= t; j = ((i & j) == j ? j + 1 : j + (j & -j)))
        {
            if ((i & j) == j)
            {
                dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
            }
        }
    }
    cout << dp[m];
    return 0;
}

Measured memory_bytes: 4156
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1, 0);
  rep(i, N) cin >> a.at(i + 1);
  vector<int> b(N + 1, 0);

  for (int i = (N / 2) + 1 ; i <= N ; i++) {
    b.at(i) = a.at(i);
  }

  for (int i = (N / 2)  ; i >= 1 ; i--) {
    int sum = 0;
    for (int j = 2 * i ; j <= N; j += i) {
      sum += b.at(j);
    }
    sum &= 1;
    if (sum != a.at(i)) b.at(i) = 1;
  }

  int M = 0;
  rep(i, N) {
    if (b.at(i + 1) == 1) M++;
  }

  cout << M << endl;
  rep(i, N) {
    if (b.at(i + 1) == 1) cout << i + 1 << " ";
  }

  cout << endl;

}


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int n;cin>>n;
  string s;cin>>s;
  char before=0;
  int idx=0;
  REP(i,n){
    char cur=s[i];
    if(cur!=before){
      idx++;
    }
    before=cur;
  }
  cout << idx << endl;
}


Measured memory_bytes: 512
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)

//typedef pair < int, int> P;
ll gcd(ll a, ll b) {//最大公約数を求める///最大公倍数a*b/gcd(a,b)
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcd(ll a, ll b) {//最小公倍数を求める　b=0のときaを返す
	if (b == 0) return a;
	return (a / gcd(a, b)) * b;
}
vector<int> calc(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}
string S;
string U;
int main()
{
	cin >> S;
	rep(i, S.size()) {
		cout << 'x';
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    string s;
    int d=0;
    cin>>s;
    int g=s.size()-1;
    for(int i=0;i<s.size()/2;i++){
        if(s[i]!=s[g-i]){
            d++;
        }
    }
    cout<<d<<endl;
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())
K = int(input())
i = 0
while True:
    if B > A:
        break
    else:
        B = B * 2
    i += 1
q = 0
while True:
    if C > B:
        break
    else:
        C = C * 2
    q += 1
if (i + q) > K:
    print("No")
else:
    print("Yes") 

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL(x) memset(x,0,sizeof(x))


using namespace std;

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

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


int main()
{
  int N, X, Y;
  cin >> N >> X >> Y;
  X--;
  Y--;

  int dist[N][N];
  int ans[N];
  FILL(ans);
  FILL(dist);


  for(int i=0; i<N; i++)
    {
      for(int j=i+1; j<N; j++)
	{
	  if(i+1==j)
	    {
	      dist[i][j]=1;
	    }
	  else if(j==Y)
	    {
	      if(i<=X)
		dist[i][j]=dist[i][X]+1;
	      else
		dist[i][j]=dist[X][i]+1;

	    }
	  else
	    {
	      dist[i][j]=dist[i][j-1]+1;
	    }
	 
	}
    }
  
  for(int i=0; i<N; i++)
    {
      for(int j=N-2; j>i; j--)
	{
	  chmin(dist[i][j], dist[i][j+1]+1);
	}    
    }
   for(int i=0; i<N; i++)
    {
      for(int j=i+1; j<N-1; j++)
	{
	  chmin(dist[i][j+1], dist[i][j]+1);
	}
    }
  

   for(int i=0; i<N; i++)
    {
      for(int j=i+1; j<N; j++)
	{
	  ans[dist[i][j]-1]+=1;
	}
      
    }




   /*  
  for(int i=0; i<N; i++)
    {
      for(int j=i+1; j<N; j++)
	{
	  cout << i+1<<","<<j+1<<" :  "<<dist[i][j] << endl;
	}
    }
   */
  rep(i,N-1)
    cout << ans[i]<<endl;
  
  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 15872
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);



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

  LL N, M; cin >> N >> M;
  vector<pair<LL,LL>> vp(N);
  REP(i,N) cin >> vp[i].first >> vp[i].second;
  vector<LL> ps(M);
  REP(i,M) cin >> ps[i];
  SORT(ps);
  ps.insert(ps.begin(), 0);
  ps.PB(1000000001LL);
  vector<LL> sum(M+2, 0);
  sum[1] = ps[1] - ps[0];
  FOR(i,2,M+2)
	sum[i] = ps[i] - ps[i-1] + sum[i-2];

  LL ans = 0;
  REP(i,N){
	int s = upper_bound(ALL(ps), vp[i].first) - ps.begin();
	int t = upper_bound(ALL(ps), vp[i].second) - ps.begin();
	if(s < t){
	  if((t - s)%2 != 0) t--;
	  ans += sum[t] - sum[s];
	  ans += ps[s] - vp[i].first;

	  if(vp[i].second <= ps[t])
		ans -= ps[t] - vp[i].second;
	}
	else if(s > t){
	  if((t - s)%2 != 0) --t;
	  ans += sum[s] - sum[t];
	  ans -= ps[s] - vp[i].first;

	  if(vp[i].second <= ps[t])
		ans += ps[t] - vp[i].second;
	}
	else
	  ans += abs(vp[i].second - vp[i].first);
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 4292
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;

const int K = 4;

struct Matrix {
  int a[K][K];

  int* operator[](int id) {
    return a[id];
  }
  const int* operator[](int id) const {
    return a[id];
  }

  Matrix(int v) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i < K; i++) {
      a[i][i] = v;
    }
  }
};

Matrix operator*(const Matrix& a, const Matrix & b) {
  Matrix res(0);
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++)
      for (int k = 0; k < K; k++) {
        res[i][j] = (int) ((res[i][j] + a[i][k] * 1LL * b[k][j]) % MOD);
      }
  return res;
}

Matrix operator^(Matrix a, int b) {
  Matrix r(1);
  while (b) {
    if (b & 1) r = r * a;
    a = a * a;
    b >>= 1;
  }
  return r;
}

struct Vector {
  int a[K];

  Vector() { memset(a, 0, sizeof(a));}

  int& operator[](int id) {
    return a[id];
  }
  const int& operator[](int id) const {
    return a[id];
  }
};

Vector operator*(const Matrix& a, const Vector& b) {
  Vector res;
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      res[i] = (res[i] + a[i][j] * 1LL * b[j]) % MOD;
    }
  }
  return res;
}

int main() {
#ifdef LOCAL
  freopen("e.in", "r", stdin);
  freopen("e.out", "w", stdout);
#endif

  Matrix F(0);



  F[1][0] = 1;
  F[1][1] = 1;

  F[2][0] = 1;
  F[2][1] = 1;
  F[2][2] = 1;

  F[3][0] = 1;
  F[3][2] = 2;
  F[3][1] = 1;
  F[3][3] = 1;


  F[0][0] = 1;
  F[0][2] = 2;
  F[0][1] = 1;
  F[0][3] = 1;

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

  Vector cur;
  cur[0] = 1;
  cur[1] = 0;
  cur[2] = 0;
  cur[3] = 0;

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

  int last = 0;

  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    cur = (F ^ (x - last)) * cur;
    cur[0] = 0;
    last = x;
  }

  cur = (F ^ (n - last)) * cur;

  printf("%d\n", cur[0]);
  return 0;
}

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

using namespace std;

#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()

template <class T>
void mini(T& l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
  l = max(l, r);
}

using LL = long long;
using LD = long double;
using ULL = unsigned long long;
const int dx[] = {0, -1, 1, 0, -1, -1, 1, 1},
          dy[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const int INF = 1e9;
const LL MOD = 1e9 + 7;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int h, v, p;
  cin >> h >> v >> p;
  vector<string> s(h);
  for (int i = 0; i < h; i++) cin >> s[i];
  int res = 0;
  int sh, sv;
  for (int k = 0; k < (1 << (h + v)); k++) {
    sh = k >> v;
    sv = k % (1 << v);
    int l = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < v; j++) {
        if (s[i][j] == '.' || (sh & (1 << i)) || (sv & (1 << j))) continue;
        l += 1;
      }
    }
    if (l == p) res += 1;
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3644
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}



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

	cout << max(a * b, max(a + b, a - b));


	return 0;
}

Measured memory_bytes: 256
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Tue Jun 26 02:13:06 2018
//
package main

import "fmt"

var S string

func main() {
	fmt.Scan(&S)

	ans := 0
	for _, s := range S {
		if s == '-' {
			ans--
		} else {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;


const int SZ = 100333;

int N;
ll A[SZ], B[SZ];

int main() {
	scanf("%d", &N);
	for (int i=1; i<=N; i++) scanf("%d", &A[i]);
	for (int i=1; i<=N; i++) scanf("%d", &B[i]);

	ll S = 0;
	for (int i=1; i<=N; i++) {
		A[i] -= B[i];
		S += A[i];
	}
	if (S < 0) {
		puts("-1");
		exit(0);
	}

	sort(A+1, A+N+1);
	reverse(A+1, A+N+1);

	int cnt = 0;
	ll need = 0;
	for (int i=1; i<=N; i++) if (A[i] < 0) {
		cnt++;
		need += A[i];
	}

	for (int i=1; i<=N; i++) if (A[i] > 0) {
		if (need >= 0) break;
		need += A[i];
		cnt++;
	}


	cout << cnt << endl;





	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
 
void mD(char C, int *D) {
  switch (C) {
    int t;
  case 'N':
    t=D[0];D[0]=D[1];D[1]=D[5];D[5]=D[4];D[4]=t;
    break;
  case 'S':
    t=D[0];D[0]=D[4];D[4]=D[5];D[5]=D[1];D[1]=t;
    break;
  case 'E':
    t=D[0];D[0]=D[3];D[3]=D[5];D[5]=D[2];D[2]=t;
    break;
  case 'W':
    t=D[0];D[0]=D[2];D[2]=D[5];D[5]=D[3];D[3]=t;
    break;
  case 'R':
    t=D[1];D[1]=D[3];D[3]=D[4];D[4]=D[2];D[2]=t;
    break;
  case 'L':
    t=D[1];D[1]=D[2];D[2]=D[4];D[4]=D[3];D[3]=t;
    break;
  }
  return;
}
 
/* サイコロが一致していたら1、それ以外は0 */
int cD(int *D1, int *D2) {
  int d;
  /* すべての面が必ず1度は上面にくる回転 */
  char C[]={' ','N','N','N','E','E','E'}; int c;
  /* 必ずC[]の要素数だけ繰り返す。 
     同じ数字が複数の面に存在する可能性があるので */
  for (c=0;c<7;c++) {
    mD(C[c], D2);
    /* サイコロ1と2の上面の数字が一致したら…… */
    if (D1[0]==D2[0]) {
      /* サイコロを右回転させて、すべての面の数字が一致する
     ポジションがないか調べる */
      for(d=0;d<6;d++) {
    mD('R', D2);
    /* ポジションがあったらフラグを立てる */
    if (D1[1]==D2[1]) {
      if ((D1[2]==D2[2]) && (D1[3]==D2[3])
          && (D1[4]==D2[4]) && (D1[5]==D2[5]))
        return 1;
    }
      }
    }
  }
  return 0;
}
 
int main(void) {
  int D[101][6],d,N,n;
  scanf("%d\n",&N);
  /* サイコロ初期値の設定 */
  for(n=0;n<N;n++)
    for(d=0;d<6;d++)
      scanf("%d",&D[n][d]);
 
  /* サイコロの一致判定 */
  for(n=0;n<(N-1);n++) {
    int m;
    for(m=n+1;m<N;m++) {
      if (cD(D[n],D[m])) {
    printf("No\n");
    return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}


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


int main()
{
  int cont=0;
  string s;
  cin>>s;

  for(int i=0;i<s.size();i++)
  {
      if(s[i]!='0') ++cont;
  }
  cout<<cont<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main(){
  int x,y,z,cnt = 0;
  cin >> x >> y >> z;
  x -= z;
  while(x >= 0){
    x -= z + y;
    cnt++;
  }
  cout << cnt - 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n,k,ans=1;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		if(ans>k) ans+=k;
		else ans+=ans;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type stack struct {
	size   int
	values []int
	top    int
}

func (s *stack) Push(val int) {
	s.values[s.top] = val
	s.top++
	// fmt.Println("Push", val)
	// fmt.Println(s.values)
	// fmt.Println("top", s.top)
}

func (s *stack) Pop() int {
	v := s.values[s.top-1]
	s.values[s.top-1] = 0
	s.top--
	// fmt.Println("Pop", v)
	// fmt.Println(s.values)
	// fmt.Println("top", s.top)
	return v
}

func (s *stack) IsEmpty() bool {
	return len(s.values) != 0
}

func (s *stack) IsFUll() bool {
	return s.size == s.top
}

func NewStack(size int) stack {
	s := stack{}
	s.size = size
	s.values = make([]int, size)
	s.top = 0
	return s
}

func main() {
	st := NewStack(100)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for {
		ret := sc.Scan()
		if ret == false {
			break
		}
		s := sc.Text()
		// fmt.Println("scan", s)
		switch s {
		case "+":
			a := st.Pop()
			b := st.Pop()
			// fmt.Printf("%d + %d = %d\n", a, b, a+b)
			st.Push(a + b)

		case "-":
			b := st.Pop()
			a := st.Pop()
			// fmt.Printf("%d - %d = %d\n", a, b, a-b)
			st.Push(a - b)

		case "*":
			a := st.Pop()
			b := st.Pop()
			// fmt.Printf("%d * %d = %d\n", a, b, a*b)
			st.Push(a * b)

		case "/":
			a := st.Pop()
			b := st.Pop()
			// fmt.Printf("%d / %d = %d\n", a, b, a/b)
			st.Push(a / b)

		default:
			v, _ := strconv.Atoi(s)
			st.Push(v)
			// fmt.Println(st.values)
		}
	}
	fmt.Println(st.Pop())

	// for _, elm := range s {
	// 	fmt.Println(elm)
	// }
}



Measured memory_bytes: 1120
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <string.h>
using namespace std;
// std::ios::sync_with_stdio(false);
typedef long long LL;
const int N = 250000;
const int M = 12;
const int INF = 0x3f3f3f3f;
const LL MOD = 1e9+7;
const double Pi = acos(-1);
int n,m;
char s[N];
int dp[1<<26];
int main()
{
    while (~scanf("%s",s))
    {
        memset(dp,INF,sizeof dp);
        int tmp = 0;
        dp[0] = 0;
        int l  = strlen(s);
        for (int i=0;i<l;i++)
        {
            tmp ^= 1<<(s[i]-'a');
            for (int j=0;j<26;j++)
                dp[tmp] = min(dp[tmp],dp[tmp^(1<<j)]+1);
        }
        printf("%d\n",max(1,dp[tmp]));
    }
    return 0;
}

/*

aabxyyzz
byebye
abcdefghijklmnopqrstuvwxyz
abcabcxabcx

*/

Measured memory_bytes: 262656