akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>
#include <list>
using namespace std;

int main()
{

	int a[2];

    cin >> a[0] >> a[1] >> a[2];

    cout << max(max(a[0], a[1]), a[2]) - min(min(a[0], a[1]), a[2]) << endl;

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    string s;
    cin >> s;
    rep(i,s.size()){
        cout << "x";
    }
    cout << endl;
}


Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
a.sort()
C=[0]
s=[a[0]]
for i in a:
    if(s[-1]==i):
        C[-1]+=1
    else:
        C.append(1)
        s.append(i)
ans=0
for i in range(len(s)):
    if C[i]<s[i]:
        ans+=C[i]
    else:
        ans+=C[i]-s[i]
print(ans)

Measured memory_bytes: 68904
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;cin>>s;
	int ct=0;
	int res=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='I')ct++;
		else ct--;
		res=max(res,ct);
	}
	cout<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

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

  int N, R;
  cin >> N >> R;
  if(N == R) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
  int n;
  cin >> n;
  
  if (n % 10 == 3) {
    cout << "bon" << endl;
  }
  else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {
    cout << "pon" << endl;
  }
  else {
    cout << "hon" << endl;
  }
  
  return 0;
}

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

int main() {
	int n,d;
	cin>>n>>d;
	d=d*2+1;
	if(n%d==0)
	    cout<<n/d<<'\n';
	else
	    cout<<n/d+1<<'\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] map = new int[N];
        for (int i = 0; i < N; i++) {
        	map[i] = sc.nextInt();
        }
        
        Arrays.sort(map);
        
        int a = 0;
        int b = 0;
        for (int i = 0; i < N; i++) {
        	if (i % 2 == 0) {
        		a+=map[i];
        	} else {
        		b+=map[i];
        	}
        }
        
        System.out.println(Math.abs(a-b));
    }
    
}

Measured memory_bytes: 22740
n = int(input())
al = [0]*(n+1)
for i in range(n):
    al[i+1] = int(input())
    
curr = 1
for i in range(10**5+1):
    next_pos = al[curr]
    if next_pos == 2:
        print(i+1)
        break
    else:
        curr = next_pos
else:
    print(-1)

Measured memory_bytes: 75444
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define INF 1001001001
#define ll long long
#define rep(i,n)  for(i=0; i<n;  i++)
#define rep2(i,n) for(i=1; i<=n; i++)

const int array[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int getMin(int a, int b){ if(a<b) return a; else return a; }
int getMax(int a, int b){ if(a>b) return a; else return b; }

int main(){
    /*memo:入力処理及びそれらに必要な変数の定義*/
    int k;
    scanf("%d",&k);
    /*memo:main関数内で使用する上記以外の変数の定義*/
    /*memo:初期設定に必要な処理*/
    /*memo:メイン処理*/
    printf("%d\n",array[k-1]);
}

Measured memory_bytes: 128
n = int(input())
s = []
for i in range(n):
    a = input()
    b = []
    for j in range(len(a)):
        if a[j]=='(':
            b.append(1)
        else:
            b.append(-1)
    s.append(b)

l = []
r = []
for x in s:
    b = 0
    c = 0
    for y in x:
        c+=y
        b = min(b,c)
    z = len(x)
    d = 0
    e = 0
    for j in range(z):
        e += x[z-j-1]
        d = max(d,e)
    if c>0:
        l.append([b,c])
    else:
        r.append([d,c])
l.sort(reverse=True)
r.sort()

flag = 1
x = 0
for b,c in l:
    if x+b<0:
        flag = 0
    x += c

y = 0
for d,c in r:
    if y+d>0:
        flag = 0
    y += c

if y+x!=0:
    flag = 0
print('Yes' if flag else'No')







Measured memory_bytes: 296484
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 55;
int n, k;
int a[maxn];

bool read() {
  if (scanf("%d%d", &n, &k) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

void solve() {
  vector<int> ans;
  int p = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] < a[p]) {
      p = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i != p) {
      ans.push_back(i);
      a[i]--;
    }
  }
  ans.push_back(p);
  a[p]--;
  while (k) {
    int cur = -1;
    for (int i = 0; i < n; i++) {
      if (i == p) {
        continue;
      }
      if (cur == -1 || a[i] < a[cur]) {
        cur = i;
      }
    }
    if (!a[cur]) {
      printf("-1\n");
      return;
    }
    for (int i = 0; i < n; i++) {
      if (i == p || i == cur) {
        continue;
      }
      ans.push_back(i);
      a[i]--;
    }
    ans.push_back(cur);
    a[cur]--;
    p = cur;
    k--;
  }
  printf("%d\n", sz(ans));
  for (int i = 0; i < sz(ans); i++) {
    printf("%d ", ans[i] + 1);
  }
  printf("\n");
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
def check(aaa, flg):
    if flg == 'o':
        if aaa[1]:
            if aaa[0] == aaa[2]:
                return 1
        else:
            if aaa[0] != aaa[2]:
                return 1
    else:
        if aaa[1]:
            if aaa[0] != aaa[2]:
                return 1
        else:
            if aaa[0] == aaa[2]:
                return 1
    return 0


def main():
    num = int(input())
    data = list(input())

    dp = [[-1 for i in range(num)] for j in range(4)]

    flg = [0 for i in range(4)]

    if data[0] == 'o':
        dp[0][0], dp[0][num - 1], dp[0][1] = 1, 1, 1
        dp[1][0], dp[1][num - 1], dp[1][1] = 1, 0, 0
        dp[2][0], dp[2][num - 1], dp[2][1] = 0, 1, 0
        dp[3][0], dp[3][num - 1], dp[3][1] = 0, 0, 1
    else:
        dp[0][0], dp[0][num - 1], dp[0][1] = 0, 1, 1
        dp[1][0], dp[1][num - 1], dp[1][1] = 0, 0, 0
        dp[2][0], dp[2][num - 1], dp[2][1] = 1, 1, 0
        dp[3][0], dp[3][num - 1], dp[3][1] = 1, 0, 1

    for i in range(1, num - 2):
        now_data = data[i]
        for j in range(4):
            if now_data == 'o':
                if dp[j][i] == dp[j][i - 1]:
                    dp[j][i + 1] = 1
                else:
                    dp[j][i + 1] = 0
            else:
                if dp[j][i] == dp[j][i - 1]:
                    dp[j][i + 1] = 0
                else:
                    dp[j][i + 1] = 1

    ans_flg = -1

    for i in range(4):
        aaa = [dp[i][num - 3], dp[i][num - 2], dp[i][num - 1]]
        bbb = [dp[i][num - 2], dp[i][num - 1], dp[i][0]]

        # print(aaa, bbb, dp[i])

        if check(aaa, data[num - 2]) and check(bbb, data[num - 1]):
            ans_flg = i

    # for i in range(4):
    #     print(dp[i])

    if ans_flg == -1:
        print(-1)
    else:
        dict = {1:'S', 0:'W'}
        for i in range(num):
            print(dict[dp[ans_flg][i]], end='')
            if i == num - 1:
                print()




if __name__ == '__main__':
    main()


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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		string x, y;
		for (int j = 0; j < n; j++) {
			if (j <= i) x += s[j];
			else y += s[j];
		}

		int cnt = 0;
		for (char c = 'a'; c <= 'z'; c++) {
			int flagx = 0, flagy = 0;

			for (int i = 0; i < x.size(); i++) {
				if (c == x[i]) flagx = 1;
			}
			for (int j = 0; j < y.size(); j++) {
				if (c == y[j]) flagy = 1;
			}

			if (flagx && flagy) cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
char f[9][9];
void tansaku(int x,int y){
	if(x<1||x>9||y<1||y>9||f[y][x]=='0')
		return ;
	if(f[y][x]=='1'){
		f[y][x]='0';
		tansaku(x-1,y);
		tansaku(x-2,y);
		tansaku(x-3,y);
		tansaku(x+1,y);
		tansaku(x+2,y);
		tansaku(x+3,y);
		tansaku(x,y+1);
		tansaku(x,y+2);
		tansaku(x,y+3);
		tansaku(x,y-1);
		tansaku(x,y-2);
		tansaku(x,y-3);
	}
}
int main(){
	
	int n;
	cin>>n;
	int k=1;

	
	while(n>0){
		int x,y;
		for(int i=1;i<9;i++){
			for(int j=1;j<9;j++){
				cin>>f[i][j];
			}
		}
		cin>>x>>y;
		tansaku(x,y);
		cout<<"Data "<<k++<<":"<<endl;
		for(int i=1;i<9;i++){
			for(int j=1;j<9;j++){
				cout<<f[i][j];
			}
			cout<<endl;
		}
		n--;
	}
	
	
	
}

Measured memory_bytes: 1160
from itertools import accumulate
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**10
from functools import reduce

n,p = map(int,input().split())
ans = 1
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d = Counter(prime_decomposition(p))
for k in d.keys():
    if d[k] >= n:
        ans =ans*(k**(d[k]//n))
print(ans)

Measured memory_bytes: 39152
#include <vector>
#include <queue>
#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 <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define SORT(x) sort(ALL(x))
#define REVE(x) reverse(ALL(x))
#define MP make_pair
#define PB push_back
#define INF INT_MAX

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef pair<int, int> PII;
typedef queue<int> QI;
typedef long long LL;

int R, C, sy, sx, gy, gx, ans;
char maze[51][51];
QI qx, qy, qk;
bool visited[51][51];
int bx[] = { 1,0,-1,0 };
int by[] = { 0,1,0,-1 };

int main() {
	int n, ans = 0;
	set<int> d;
	cin >> n;
	REP(i, n) {
		int x; cin >> x;
		d.insert(x);
	}
	for (auto i : d)ans++;
	cout << ans << endl;
}

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

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

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;

const ll INF = (1LL<<60);

int main(){

    ll a, b; cin >> a >> b;

    ll n = 1;
    ll ans = 0;
    while(n<b){
        n = n-1 + a;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int S, W;
    cin >> S >> W;

    if(S > W){
        cout << "safe" << endl;
    }
    else{
        cout << "unsafe" << endl;
    }


}

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

int main(){
  int n,x; cin >> n >> x;
  int sum = 0;
  rep(i,n){
    int l; cin >> l;
    sum += l;
    if(sum > x){
      cout << i+1;
      break;
    }
  }
  if(sum <= x) cout << n+1;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int x, a;
	cin >> x >> a;
	
	if( x < a ) cout << 0 << endl;
	else cout << 10 << endl;
	
	return 0;
}


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

void no() {
    cout<<"NO"<<endl;
    exit(0);
}

const int N = 1e5+7;
int a[N];

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

    int n;
    cin>>n;

    long long sum = 0, B = 1LL*n*(n+1)/2;
    for (int i=1; i<=n; i++) {
        int x;
        cin>>x;
        sum += x;
        a[i] = x;
    }
    a[0] = a[n];

    if (sum%B)  no();
    long long K = sum/B;

    for (int i=1; i<=n; i++) {
        long long D = a[i] - a[i-1];
        if ((K-D)%n || K-D<0)    no();
    }
    cout<<"YES\n";
}


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

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

    long a[n];
    long sub[n];
    sub[0] = 0;

    for (long i = 1; i < n; i++)
    {
        cin >> a[i];
        sub[i] = 0;
    }

    for (long i = 1; i < n; i++)
    {
        sub[a[i] - 1]++;
    }

    for (long i = 0; i < n; i++)
    {
        cout << sub[i] << endl;
    }
}


Measured memory_bytes: 6312
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int LL;
typedef int ll;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
 
const ll M=2e5+5,LG=19,SM=2000+5,inf=1e9+1;
ll mod=1e9+7;
 
ll n;
ll a[M]; 
str z[2]={"First","Second"};
void ret(ll x)
{
    cout << z[x];
    exit(0);
}

int main()
{
	ios::sync_with_stdio(0);
    cin >> n;
    For(i,0,n) cin >> a[i];
    sort(a,a+n,[](ll i,ll j){ return i>j; });
    a[n]=-inf;
    ll x=0;
    For(i,0,n)
    {
        if (a[i]>i)
            x=i;
        else
            break;
    }
    if ((a[x]-x)%2==0) ret(0);
    if (a[x+1]<x+1) ret(1);
    ll y=x+1;
    while (a[y]==a[x+1]) y++;
    ret((y-x)%2);   
}

Measured memory_bytes: 640
# include <bits/stdc++.h>
using namespace std;
# define ll  long long
# define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,dp[100001]={0},h[100001]={0};
    cin>>n>>k;
    for(ll i=0;i<n;i++) cin>>h[i];
    dp[0]=0;
    for(ll i=1;i<n;i++)
    {
        ll j=i-1;
        dp[i]=INT_MAX;
        while(j>=0 && j>=i-k)
        {
            dp[i] = min(dp[j]+abs(h[i]-h[j]),dp[i]);
            j--;
        }
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
#末尾の数字と読み方を定義
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = 3

#標準入力の下一桁を取得
a = (gets.to_i) % 10

#標準入力の下一桁がhon,bon,ponのどれに含まれる確認
if a == bon
  puts "bon"
elsif hon.include?(a)
  puts "hon"
elsif pon.include?(a)
  puts "pon"
end

Measured memory_bytes: 14372
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	bool is_visited = false;
} node;
typedef struct {
	int to;
	int cost;
	P <int, int> change;
} edge;

int main( void ){
	int N, M; cin >> N >> M;
	priority_queue <int> que;
	rep( i, 0, N ){
		int input; cin >> input;
		que.push( input );
	}
	rep( i, 0, M ){
		int top = que.top(); que.pop();
		que.push( top / 2 );
	}
	ll sum = 0;
	rep( i, 0, N ){
		sum += que.top(); que.pop();
	}
	cout << sum << endl;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 892
n, m = map(int, raw_input().split(" "))


def hoge(a):
    return (int(a), 1)


a = map(hoge, raw_input().split(" "))


for i in range(0, m):
    b, c = map(int, raw_input().split(" "))
    a.append((c, b))


s = sorted(a, key=lambda (p, q): p, reverse=True)
#print(s)

count = 0
ans = 0
for i in range(0, len(s)):
    e1, e2 = s[i]

    if count + e2 <= n:
        #print("%d %d" % (e1, e2))
        ans += e1 * e2
        count += e2

    else:
        #print("%d %d" % (e1, (n - count)))
        ans += e1 * (n - count)
        break

    if count == n:
        break

print(ans)


Measured memory_bytes: 37484
def resolve():
    num_books, num_algo, goal = map(int, input().split())
    books = []
    min_price = 10**8
    for i in range(num_books):
        books.append(list(map(int, input().split())))

    for i in range(2 ** num_books):
        bought = []
        for j in range(num_books):
            if ((i >> j) & 1):
                bought.append(books[j])
        total_price = 0
        skils = [0 for k in range(num_algo)]

        for book in bought:
            total_price += book[0]
            for k in range(num_algo):
                skils[k] += book[1+k]

        achieved_flag = True

        for skil in skils:
            if skil < goal:
                achieved_flag = False

        if (total_price < min_price and achieved_flag):
            min_price = total_price

    if min_price == 10**8:
        print(-1)
    else:
        print(min_price)
resolve()

Measured memory_bytes: 68568
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	int len = S.size();
	vector<vector<int64_t>> dp(len + 1, vector<int64_t>(13, 0));
	dp[0][0] = 1LL;

	for (int i = 0; i < len; i++) {
		for (int j = 0; j < 13; j++) {
			if (S[i] == '?') {
				for (int k = 0; k <= 9; k++) {
					dp[i + 1][(10 * j + k) % 13] += dp[i][j];
					dp[i + 1][(10 * j + k) % 13] %= MOD;
				}
			}
			else {
				int n = S[i] - '0';
				//cout << n << endl;
				dp[i + 1][(10 * j + n) % 13] += dp[i][j];
				dp[i + 1][(10 * j + n) % 13] %= MOD;
			}
		}
	}

	cout << dp[len][5] << endl;
}

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

int main(){
    int n;
    cin>>n;
    int a[100];
    int total=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        total+=a[i];
    }
    double mini=1000;
    double ave=1.00*total/n;
    int ans;
    for(int i=0;i<n;i++){
        double dif=abs(ave-a[i]);
        if(dif<mini){
            mini=dif;
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int Le(int);
int Ri(int);

int oya(int x){
  return x / 2;
}



int main(){
  int n,i,A[100001];

  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++){
    scanf("%d",&A[i]);
  }

  for(i = 1 ; i <= n ; i++){
    printf("node %d: key = %d, ",i,A[i]);

    if(oya(i) >= 1) printf("parent key = %d, ",A[oya(i)]);
    if(Le(i) <= n) printf("left key = %d, ",A[Le(i)]);
    if(Ri(i) <= n) printf("right key = %d, ",A[Ri(i)]);

    printf("\n");
  }

  return 0;
}



int Le(int x){
  return 2 * x;
}

int Ri(int x){
  return 2 * x + 1;
}



Measured memory_bytes: 2112
#include <iostream>

 

using namespace std;

 

int main()
{
   int i, h, m, s;     
   cin >> i;
   h = i / 3600;
   m = i / 60 - h * 60;
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl;
   
   return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, T;
  cin >> N >> T;
  int a, b, ans = 0;
  cin >> a;
  for(int i = 0; i < N - 1; i++) {
    cin >> b;
    ans += min(b - a, T);
    a = b;
  }
  ans += T;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const double eps = 1e-9;

string s;
int c[101];

int32_t main()
{
	cin >> s;
	for(char a : s)
		c[a-'0']++;
		
	bool r = true;
	for(int i=0; i<100; i++)
		if(c[i] != 0 and c[i]%2 == 1)
			r = false;

	puts(r ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string val;
    cin >> val;
    for(int i = 0; i < val.length()-1; i++){
        if(val[i]==val[i+1]){
            cout << (i+1) << " " << (i+2) << "\n";
            return 0;
        }
    }
    for(int i = 0; i < val.length()-2; i++){
        if(val[i]==val[i+2]){
            cout << (i+1) << " " << (i+3) << "\n";
            return 0;
        }
    }
    cout << "-1" << " " << "-1" << "\n";
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM =  1000000007;
int main()
{
    // 整数の入力
    ll L,R,minimum,realL,diff,BASE;
    minimum = 2020;
    BASE = 2019;
    cin >> L >> R;
    realL = L % BASE;
    diff = min(R - L,2020LL);
    for (int i = realL;i < realL + diff;i++){
        for(int j = i + 1; j <= realL + diff;j++){
            // cout << i << " " << j<<endl;
            minimum = min(minimum,(i * j) % BASE);
        }
    }
    cout << minimum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
int main(void){
    // Here your code !
    int n;
    scanf("%d", &n);
   for (int i = 1; i <= n; i++){
       if (i % 3 == 0){
           printf(" %d", i);
       }
       else if (i % 10 == 3){
           printf(" %d", i);
       }
       else {
           for (int j = 10; i / j; j *= 10){
               if ((i / j) % 10 == 3){
                   printf(" %d", i);
                   break;
               }
           }
       }
   }
   printf("\n");
    return 0;
}

Measured memory_bytes: 2740
#include<stdio.h>
#include<stdlib.h>

int A[2000];

 int search(int n,int A[],int i,int m){
  
  if(m == 0) return 1;

  else if(i >= n) return 0;
  
  return (search(n, A, i + 1, m) || search(n, A, i + 1, m - A[i]));
}


extern void solve(int n,int A[],int q,int M[]){
  int i;
  
  for(i=0;i<q;i++)
    if(search(n,A,0,M[i]) == 1)
      printf("yes\n");
    else
      printf("no\n");
}

int main(){
  int n,*M,i,q;
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  
  scanf("%d",&q);
  
  M = (int*)malloc(sizeof(q));
   
  for(i=0;i<q;i++)
    scanf("%d",&M[i]);

  solve(n,A,q,M);
  
  return 0;
}



Measured memory_bytes: 2048
unittest
{
	assert( [ "YAKINIKU" ].parse.expand.solve == "Yes" );
	assert( [ "TAKOYAKI" ].parse.expand.solve == "No" );
	assert( [ "YAK" ].parse.expand.solve == "No" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	return ( 4 <= s.length && s[ 0 .. 4 ] == "YAKI" ) ? "Yes" : "No";
}


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

typedef long long int ll;

ll MOD = 1000000007;
ll INF = 100000000000;

int H,W;
char field[2010][2010];

int search(int y,int x){
  int res = 1;
  for(int i = x+1;i < W+1;i++){
    if(1 <= i && i <= W){
      if(field[y][i] == '.'){
        res++;
      }else{
        break;
      }
    }
  }
  for(int i = x-1;i >= 1;i--){
    if(1 <= i && i <= W){
      if(field[y][i] == '.'){
        res++;
      }else{
        break;
      }
    }
  }
  for(int i = y+1;i <= H;i++){
    if(1 <= i && i <= H){
      if(field[i][x] == '.'){
        res++;
      }else{
        break;
      }
    }
  }
  for(int i = y-1;i >= 1;i--){
    if(1 <= i && i <= H){
      if(field[i][x] == '.'){
        res++;
      }else{
        break;
      }
    }
  }
  return res;
}

int main(){
  cin >> H >> W;
  for(int i = 1;i < H+1;i++){
    string S;cin >> S;
    for(int j = 0;j < W;j++){
      field[i][j+1] = S[j];
    }
  }
  vector<vector<int>> tableX(H+10,vector<int>(W+10));
  vector<vector<int>> tableY(H+10,vector<int>(W+10));
  for(int i = 1;i <= H;i++){
    queue<int> Q;
    int memo = 0;
    for(int j = 1;j <= W;j++){
      if(field[i][j] == '.'){
        memo++;
      }else{
        if(memo != 0){
          Q.push(memo);
          memo = 0;
        }
      }
      if(j == W && field[i][j] == '.'){
        Q.push(memo);
          memo = 0;
      }
    }
    /*int n = Q.size();
    for(int k = 0;k < n;k++){
      cout << Q.front() <<' ';
      Q.pop();
    }*/
    bool frag = 0;
    for(int j = 1;j <= W;j++){
      if(field[i][j] == '.'){
        frag = 1;
        tableX[i][j] = Q.front();
      }else{
        if(frag){
          Q.pop();
          frag = 0;
        }
      }
    }
  }
  for(int i = 1;i <= W;i++){
    queue<int> Q;
    int memo = 0;
    for(int j = 1;j <= H;j++){
      if(field[j][i] == '.'){
        memo++;
      }else{
        if(memo != 0){
          Q.push(memo);
          memo = 0;
        }
      }
      if(j == H && field[j][i] == '.'){
        Q.push(memo);
          memo = 0;
      }
    }
    /*int n = Q.size();
    for(int k = 0;k < n;k++){
      cout << Q.front() <<' ';
      Q.pop();
    }*/
    bool frag = 0;
    for(int j = 1;j <= H;j++){
      if(field[j][i] == '.'){
        frag = 1;
        tableY[j][i] = Q.front();
      }else{
        if(frag){
          Q.pop();
          frag = 0;
        }
      }
    }
  }
  /*for(int i = 1;i <= H;i++){
    for(int j = 1;j <= W;j++){
      cout << tableX[i][j];
    }
    cout << endl;
  }
  for(int i = 1;i <= H;i++){
    for(int j = 1;j <= W;j++){
      cout << tableY[i][j];
    }
    cout << endl;
  }*/
  int ans = 0;
  for(int i = 1;i <= H;i++){
    for(int j = 1;j <= W;j++){
      ans = max(ans,tableX[i][j] + tableY[i][j]);
    }
  }
  cout << ans - 1 << endl;
}


Measured memory_bytes: 35840
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n;
    m = sqrt(n);
    cout << m * m << endl; 
    return 0;
}

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

#define  __  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define  int  long long
#define  endl  '\n'
const double pi = acos(-1);
const int mod = 1e9 + 7;
//______________________



int32_t main()
{ 
  __

  
  int r,d,x;

  cin>>r>>d>>x;
  vector<int> ans;
  for(int i=0;i<10;i++)
  {
    int xx=r*x-d;
    ans.push_back(xx);
    x=xx;
  }

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

  for(int i: ans)
    cout<<i<<endl;
 return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
	if b == 0:
		return a
	else:
		return gcd(b , a%b)	

if __name__ == '__main__':
	d = [int(s) for s in input().split()]
	d.sort()
	while len(d) != 1:
		res=gcd(d[0],d[1])
		del d[:1]
		d[0] = res
	print(d[0])


Measured memory_bytes: 5604
s=list(input())
n=len(s)
if n%2==0:
    n_e=n//2
    n_o=n//2
else:
    n_e=n//2+1
    n_o=n//2
s_e=s[0::2]
s_o=s[1::2]
s_e0=s_e.count("0")
s_o0=s_o.count("0")

ans=min(n_e-s_e0+s_o0,n_o-s_o0+s_e0)
print(ans)

Measured memory_bytes: 4652
def main():
    N, M = map(int, input().split())
    switchs = []
    for _ in range(M):
        ks = list(map(int, input().split()))
        switchs.append([1 << s - 1 for s in ks[1:]])
    p = list(map(int, input().split()))
    ans = 0
    for b in range(1 << N):
        f = True
        for i, s in enumerate(switchs):
            c = 0
            for ss in s:
                if b & ss:
                    c += 1
            if c % 2 != p[i]:
                f = False
                break
        if f:
            ans += 1
    print(ans)

main()

Measured memory_bytes: 3064
#include<stdio.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
int gcd(int p, int q) {
	if (q == 0)return p;
	gcd(q, p%q);
}
int main() {
	int p,q;
	S(d, p), S(d, q);
	q /= gcd(p,q);
	p = 2;
	int c = 1;
	while(p*p<=q){
		if (q%p == 0) {
			c *= p;
			while (q%p == 0)q /= p;
		}
		p++;
	}
	P(d, q == 1 ?c:c*q);
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
using namespace std;
int main(){
	string s;cin>>s;
	vector<int> a(4);
	for(int i=0;i<4;i++){
		a[i]=s[i]-'0';
	}
	for(int S=0;S<8;S++){
		int ans=a[0];
		for(int i=0;i<3;i++)if(S>>i & 1)ans+=a[i+1];else ans-=a[i+1];
		if(ans==7){
			string s="0-0-0-0=7";
			for(int i=0;i<4;i++)s[i*2]+=a[i];
			for(int i=0;i<3;i++)if(S>>i & 1)s[i*2+1]='+';
			cout<<s<<endl;
			return 0; 
		}
	}
}

Measured memory_bytes: 256
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(ll i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//printf<=>cout
    cin.tie(nullptr);//cin<=>cout


    string S,T;
    cin >>S;
    cin >>T;

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

    ll ans =0;
    rep(i,S.size()){
        if(S[i]!=T[i])ans++;
    }

    cout << ans <<'\n';


    return (0);
}

Measured memory_bytes: 3836
#include <iostream>
#include <cmath>
#include <iomanip>
using std::string;
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;

int main(void){
  double a,b,c,d;
  double x,y;
  cin >> a >> b >> c >> d;
  double e;

  x = (a-c)*(a-c);
  y = (b-d)*(b-d);

  e = sqrt(x + y);


 cout << setprecision(10) << e << endl;
}

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

char *data;
int JOI[3];

int main(){
	int i = 0,len,count = 0;
	int level,maxlevel = 0;
	data = new char[1000002];
	scanf("%s",data);
	len = strlen(data);
	while(i < len){
		//JOI列の始め'J'が出るまで待機
		for(;i < len && data[i] != 'J';i++);
		//連続した'J'の数を入れてみる
		for(;i < len;i++){
			if(data[i] == 'J'){
				count++;
			}
			else{
				JOI[0] = count;
				count = 0;
				break;
			}
		}
		//'J'の次がOでなければ、'J'がくるまでJOI列はできない
		if(data[i] != 'O')
			continue;
		for(;i < len;i++){
			if(data[i] == 'O'){
				count++;
			}
			else{
				JOI[1] = count;
				count = 0;
				break;
			}
		}
		//'O'の次が'I'でなければ、('J'がくるまで)JOI列はできない
		if(data[i] != 'I')
			continue;
		//連続した'I'の数をカウント。ただし、最後の文字がIの場合、そのときもJOI列ができている場合があることに注意。
		//すなわち、i == lenになった場合も、カウントする処理を入れてあげる。
		for(;;i++){
			if(data[i] == 'I' && i < len){
				count++;
			}
			else{
				JOI[2] = count;
				count = 0;
				break;
			}
		}
		//ここまででJ…O…I…と並んでいるので、これらの個数について調べてみよう.実はこのJ…〜I…までを考えるときには、
		//JOI列のレベルはOの数<=J,Iの数の時にレベル = Oの数となる。(シュミレーションすればわかります)
		level = 0;
		if(JOI[1] <= JOI[0] && JOI[1] <= JOI[2])
			level = JOI[1];
		if(maxlevel < level)
			maxlevel = level;
	}
	printf("%d\n",maxlevel);
	return 0;
}

Measured memory_bytes: 1976
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define SREP(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int h, w;
	scanf("%d %d", &h, &w);
	char s[52][53];
	REPS(i, h) {
		scanf("%s", &s[i][1]);
	}
	REP(i, h+2) {
		s[i][0] == '.';
		REP(j, w + 2) {
			if (i == 0 || i == h + 1)s[i][j] = '.';
		}
		s[i][w + 1] = '.';
		s[i][w + 2] = '\0';
	}

	int flag = 0;
	REPS(i, h+1) {
		if (flag)break;
		REPS(j, w+1) {
			if (flag)break;
			if (s[i][j] == '#') {
				REP(k, 4) {
					if (s[i + diff[k][0]][j + diff[k][1]] == s[i][j])break;
					if (k == 3)flag = 1;
				}
			}
		}
	}
	if (flag) {
		puts("No");
	}
	else {
		puts("Yes");
	}
}

Measured memory_bytes: 128
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
s=[]
for i in range(m-1):
    s.append(x[i+1]-x[i])
s=sorted(s,reverse=True)
ans=0
for j in range(len(s)):
    if n>1:
        n-=1
    else:
        ans+=s[j]

print(ans)


Measured memory_bytes: 13968
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char S[100002];
int N;
int main(){
  int i;
  N = rd(S);
  for(i=(1);i<(N);i++){
    if(S[i-1]==S[i]){
      wt_L(i);
      wt_L(' ');
      wt_L(i+1);
      wt_L('\n');
      return 0;
    }
  }
  for(i=(2);i<(N);i++){
    if(S[i-2]==S[i]){
      wt_L(i-1);
      wt_L(' ');
      wt_L(i+1);
      wt_L('\n');
      return 0;
    }
  }
  wt_L(-1);
  wt_L(' ');
  wt_L(-1);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190827-1

// --- original code ---
// char S[100002]; int N;
// {
//   int i;
//   rd(S@N);
//   rep(i,1,N) if(S[i-1]==S[i]) wt(i, i+1), return 0;
//   rep(i,2,N) if(S[i-2]==S[i]) wt(i-1, i+1), return 0;
//   wt(-1,-1);
// }


Measured memory_bytes: 384
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = 0
for i in range(n):
    for j in range(i,i+2):
        if a[j]>0:
            x = min(a[j],b[i])
            b[i] -= x
            a[j] -= x
            ans += x

print(ans)


Measured memory_bytes: 19116
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


const int mod=1000000007;
//const int mod=998244353;
ll n, m, k;
vector<string> v;

vvi mark;
vvi  dist;

bool isvalid(int i,int j){
    if(i<0||j<0||i>n-1||j>m-1||v[i][j]=='@'){
        return false;
    }
    return true;
}


void bfs(int u, int v){
    queue<pii> q;
    q.push({u,v});
    vi di({0,0,-1,1}),dj({-1,1,0,0});
    while(!q.empty()){
        pii f=q.front();
        q.pop();
        mark[f.fi][f.se]=1;
        for(int i=0; i<4; i++){
            for(int j=1; j<=k; j++){
                int nx=f.fi+di[i]*j,ny=f.se+dj[i]*j;
                if(!isvalid(nx,ny))break;
                if(mark[nx][ny]&&dist[f.fi][f.se]+1>dist[nx][ny])break;
                if(mark[nx][ny])continue;
                mark[nx][ny]=1;
                dist[nx][ny]=dist[f.fi][f.se]+1;
                q.push({nx,ny});
            }
        }
    }
}
int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,q,x,a,b,c,d,y,l,r,p;
    cin >> n >> m >> k;
    cin >> a >> b >> c >> d;
    a--;b--;c--;d--;
    v.resize(n);
    mark.resize(n,vi(m,0));
    dist.resize(n,vi(m,1e9));
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    dist[a][b]=0;
    bfs((int)a,(int)b);
    if(dist[c][d]!=1e9){
        cout << dist[c][d] << el;
    }
    else{
        cout << -1 << el;
    }
    return 0;
}
    


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

int main() {

    int n,m;

    cin >> n >> m;

    double p = 1.0;
    int count = m;
    while(count--){
        p /= 2.0;
    }

    int ans = (1900*m  + 100*(n-m)) / p;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {												
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/o_o/MyCodes/pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  

void solve(){
	string s; re(s) ;
	rep(i,0,sz(s)) cout << 'x';
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3604
#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 = 200000;
const int mo = 1e9 + 7;

int n;
char st[N + 5];
int f[N + 5], lst[3];

bool chk() {
    for(int i = 1; i < n; ++i) {
        if(st[i] == st[i + 1]) return false;
    }
    return true;
}

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

    scanf("%s", st + 1);
    n = strlen(st + 1);

    if(chk()) return !puts("1");

    f[0] = 1;
    lst[0] = 0;
    lst[1] = lst[2] = -1;

    int c = 0, all = 0;
    for(int i = 1; i <= n; ++i) all = (all + st[i] - 'a' + 1) % 3;
    for(int i = 1; i <= n; ++i) {
        c = (c + st[i] - 'a' + 1) % 3;
        for(int j = 1; j < 3; ++j) if(lst[(c-j+3)%3] >= 0) {
            f[i] = (f[i] + f[lst[(c - j + 3) % 3]]) % mo;
        }
        lst[c] = i;

        if(c == 0 && i < n) { f[i] = (f[i] + 1) % mo; }
    }
    printf("%d\n", f[n]);

    return 0;
}


Measured memory_bytes: 768
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()

if int(menu[4])==0:
    iti=0
    marume=0
else:
    while menu[0]=="0":
        menu.remove("0")
    iti=int(menu[0])
    marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
                
print(iti + marume +time)

Measured memory_bytes: 3064