akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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


Measured memory_bytes: 256
n,l = list(map(int,input().split()))
n_l = []
for i in range(n):
    n_l.append(i+l)
    
min_i = 100000
for i in n_l:
    if abs(i) < abs(min_i):
        min_i = i

print(sum(n_l) - min_i)


Measured memory_bytes: 38256
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <bitset>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <random>
#include <cassert>
#include <iterator>
#include <utility>

using namespace std;

//#define FAST_ALLOCATOR_MEMORY 2e8
#undef LOCAL
//#include "optimization.h"

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

#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k % 2 == 0)
		cout << a - b;
	else
		cout << b - a;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
    string s, t;
    cin >> s >> t;

    vector<set<char>> temp1(26);
    vector<set<char>> temp2(26);

    rep(i, s.size()) {
        temp1[s[i] - 'a'].insert(t[i]);
        temp2[t[i] - 'a'].insert(s[i]);
    }

    rep(i, 26) {
        if(temp1[i].size() > 1 || temp2[i].size() > 1) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 3856
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    s=chomp(readline())
    flg=true
    for i in 1:length(s)
        if i%2==1 && !in(s[i],"RUD")
            flg=false
        elseif i%2==0 && !in(s[i],"LUD")
            flg=false
        end
    end
    println(ifelse(flg,"Yes","No"))
end
main()

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

int main() {
	int64_t N, K;
	cin >> N >> K;
	while (true) {
		if (N > K) N = N % K;
		else {
			cout << min(N, K - N) << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = (int)s.size();
    int ans = l;
    REP(i,26){
        char c = (char)('a'+i);
        int cnt = 0;
        int m = 0;
        for(int j = l-1;j>=0;j--){
            if(s[j]==c){
                m = max(m,cnt);
                cnt = 0;
            }else{
                cnt++;
            }
        }
        m = max(m,cnt);
        ans = min(ans, m);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str;
		String stack;
		int i;
		int flag;

		while(true){
			str = sc.nextLine();
			if(".".equals(str)) break;

			i = 0;
			flag = 0;
			stack = " ";

			for(int j=0; j<str.length(); j++){
				if(str.charAt(j) == '['){
					stack += "[";
					i++;
				}else if(str.charAt(j) == '('){
					stack += "(";
					i++;
				}else if(str.charAt(j) == ']'){
					if(!stack.endsWith("[")){
						flag = 1;
						break;
					}else{
						stack = stack.substring(0, i);
						i--;
					}
				}else if(str.charAt(j) == ')'){
					if(!stack.endsWith("(")){
						flag = 1;
						break;
					}else{
						stack = stack.substring(0, i);
						i--;
					}
				}
			}

			if(flag!=0 || !" ".equals(stack)){
				System.out.println("no");
			}else{
				System.out.println("yes");
			}
		}
	}
}

Measured memory_bytes: 54124
package main

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

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	// a := make([][]int, 3)
	// for i := 0; i < 3; i++ {
	// 	a[i] = make([]int, 3)
	// }
	// for i := 0; i < 3; i++ {
	// 	for j := 0; j < 3; j++ {
	// 		a[i][j] = nextInt()
	// 	}
	// }

	n := nextInt()

	var a []int
	var bob int
	var alice int

	for i := 0; i < n; i++ {
		a = append(a, nextInt())
	}
	sort.Ints(a)

	for {
		if len(a) > 0 {
			alice += a[len(a)-1]
			a = a[:len(a)-1]
		} else {
			break
		}
		if len(a) > 0 {
			bob += a[len(a)-1]
			a = a[:len(a)-1]
		} else {
			break
		}
	}

	fmt.Println(alice - bob)

}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60 ;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに
 
//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
 
// ------- library ------- //

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }

  //木の数（接続していないグラフの数）を返す
  //根となっているノード（data[k]が負のもの）を数えるだけ
  int trees() {
    int ans = 0;
    for (int each_d : data){
      if (each_d < 0){
        ans += 1;
      }
    }
    return ans;
  }
};

// ----- library end ----- //



int main() {
    
  ll N, M;
  cin >> N >> M;
  UnionFind UF(N);

  int x, y, z;
  rep(i, M){
    cin >> x >> y >> z;
    x -= 1;
    y -= 1; //0-indexedに
    UF.unite(x, y);
  }

  cout << UF.trees() << endl;


// -- main() end -- //
}


 

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

int main()
{
    int array[101];
    int n, count = 0;
    
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> array[i];
    
    for(int i = 0; i < n; ++i){
        int m = i;
        for(int j = i + 1; j < n; ++j){
            if(array[j] < array[m]){
                m = j;
            }
        }
        if(m != i){
            swap(array[m],array[i]);
            ++count;
        }
    }
    
    for(int i = 0; i < n; ++i){
        if(i != 0) cout << ' ';
        cout << array[i];
    }
    cout << endl;
    cout << count << endl;
}

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

int main(){
	
	string s;
	cin >> s;
	if(s.length()==1){
		cout << 0 << endl;
		return 0;
	}
	string zeroSecond="",zeroFirst="";
	for(ll i=0;i<s.length();i++){
		if(i%2==0){
			zeroFirst+='0';
			zeroSecond+='1';
		} else {
			zeroFirst+='1';
			zeroSecond+='0';
		}
	}
	ll st=0,sc=0;
	for(ll i=0;i<s.length();i++){
		if(s[i]!=zeroFirst[i]){
			st++;
		}
		if(s[i]!=zeroSecond[i]){
			sc++;
		}
	}
	cout << min(st,sc) << endl;

	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <string>
#include <random>
#include <queue>


using namespace std;

// ans = a ? b : c; // to simplify: if (a) ans = b; else ans = c;
// ans += val; // to simplify: ans = ans + val; and its variants
// index = (index + 1) % n; // index++; if (index >= n) index = 0;
// index = (index + n - 1) % n; // index--; if (index < 0) index = n - 1;
// int ans = (int)((double)d + 0.5); // for rounding to nearest integer
// ans = min(ans, new_computation); // min/max shortcut
// alternative form but not used in this book: ans <?= new_computation;
// some code use short circuit && (AND) and || (OR)

typedef long long ll; // comments that are mixed in with code
typedef pair<int, int> ii; // are aligned to the right like this
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
#define INF 1000000000
#define M_PI 3.14159265358979323846

void printVector2d(vector<vector<int>> a){
    for(int i=0;i<a.size();i++){
        for(int j=0;j<a[i].size();j++){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<"end"<<endl;
}

void printVector(vector<int> a){
    for(int i=0;i<a.size();i++){
        int curr_num = a[i]+1;
        cout<<curr_num<<" ";
    }
    cout<<endl;
}

void printVectorTwo(vector<int> a){
    for(int i=0;i<a.size();i++){
        int curr_num = a[i];
        cout<<curr_num<<" ";
    }
    cout<<endl;
}

void printVectorPair(vector<pair<int,int>> a){
    for(int i=0;i<a.size();i++){
        cout<<"Total "<<i<<": "<<a[i].first<<" "<<a[i].second<<endl;
    }
}

void printMap(map<char, int> mp){
    for(auto x:mp){
        cout<<x.first<<": "<<x.second<<endl;
    }
}

void printMapVec(map<int, vector<int>> mpV){
    for(auto x:mpV){
        cout<<x.first<<": ";
        for(auto y:x.second){
            cout<<y<<" ";
        }
        cout<<endl;
    }
}

void printQueue(queue<char> q){
    while(!q.empty()){
        cout<<q.front()<<" ";
        q.pop();
    }
    cout<<" ##### ";
}

long double distance_from_origin(ll Xi, ll Yi){
    return (long double)pow((Xi*Xi)+(Yi*Yi), 0.5);
}

void solve(){
    ll N,D,Xi,Yi,count_less_than_D;
    cin>>N>>D;

    count_less_than_D = 0;

    for(int i=0;i<N;i++){
        cin>>Xi>>Yi;
        if(distance_from_origin(Xi,Yi)<=D){
            count_less_than_D ++;
        }
    }

    cout<<count_less_than_D<<endl;
}

int main() {
    //solve();
    int T;
//    cin >> T;
    T=1;
    for (int case_num = 1; case_num <= T; case_num++) {
//        cout<<"Case #"<<case_num<<": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3164
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

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

const int kMaxN = 1002, kInf = 1 << 28;
int N, M, S, G1, G2;
int d[kMaxN][kMaxN];

int main() {
  while (scanf("%d%d%d%d%d", &N, &M, &S, &G1, &G2), N) {
    --S; --G1; --G2;
    
    // init
    rep(i,N) fill(d[i], d[i] + N, kInf);
    rep(i,N) d[i][i] = 0;

    // record
    int u, v, c;
    rep(i,M) {
      scanf("%d%d%d", &u, &v, &c);
      --u; --v;
      d[u][v] = c;
    }

    // warshall froyd
    rep(k,N) {
      rep(i,N) {
        rep(j,N) {
          d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
      }
    }

    // search point of k
    int ret = kInf;
    rep(k,N) {
      ret = min(ret, d[S][k] + d[k][G1] + d[k][G2]);
    }
    printf("%d\n", ret);
  }
  return 0;
}

Measured memory_bytes: 1580
n = int(input())
 
XY = []
for i in range(n):
    a = int(input())
    xy = []
    for j in range(a):
        xy.append(list(map(int, input().split())))
    
    XY.append(xy)
    
def check(i, xiyj, HoU):
    # 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
    if ((i >> xiyj) & 1) ^ HoU:
        return False
 
    return True
    
max_honest = 0
for i in range(2 ** len(XY)):
    count = 0
    honest = [0] * len(XY)
    is_contradiction = True
    for j in range(len(XY)):
        # 正直者と仮定したときだけ採用
        if not ((i >> j) & 1): continue
        for k in range(len(XY[j])):
            xiyj = XY[j][k][0] - 1
            HoU = XY[j][k][1]
            
            if not check(i, xiyj, HoU):
                is_contradiction = False
 
    if is_contradiction:
        for j in range(len(XY)):
            if ((i >> j) & 1): count+=1 
                
        if count > max_honest:
            max_honest =count
            
print(max_honest)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[20][5010];

void Max(ll &a,ll b){a=max(a,b);}

ll calc(vector<ll> &A,int n){
  ll res=0;
  for(int i=0;i<n;i++)res+=A[i]+(n-1);
  return res;
}

int main(){
  int n,K;
  cin>>n>>K;

  vector<ll> A[10];
  for(int i=0,a,b;i<n;i++) cin>>a>>b,A[b-1].push_back(a);

  for(int i=0;i<10;i++) sort(A[i].begin(),A[i].end(),greater<ll>());
  
  for(int i=0;i<10;i++){
    for(int k=0;k<=K;k++){
      Max(dp[i+1][k],dp[i][k]);
      for(int j=0;j<A[i].size();j++){
	Max(dp[i+1][k+j+1],dp[i][k]+calc(A[i],j+1));
      }
    }
  }
  cout << dp[10][K]<<endl;
  
  return 0;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

bool f[1005005];

int main(){
    ll k;
    cin >> k;
    ll surplus = 7%k;
    if(surplus == 0) {
        cout << 1 << endl;
        return 0;
    }
    for(int i = 1; ; i++) {
        //cout << surplus << endl;
        if(f[surplus]) {
            cout << -1 << endl;
            return 0;
        }
        f[surplus] = true;
        surplus = (7 + (surplus*10)%k) % k;
        if(surplus == 0) {
            cout << i+1 << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 4600
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
AtoB=[0 for i in range(n)]
BtoC=[0 for i in range(n+1)]
for i in range(n):
  top=a[i]
  h=n
  l=-1
  while h-l>1:
    mid=(h+l)//2
    if b[mid]>top:
      h=mid
    else:
      l=mid
  if h==0 and top>b[0]:
    h=-1
  AtoB[i]=h #smallestB-index
for i in range(n-1,-1,-1):
  top=b[i]
  h=n
  l=-1
  while h-l>1:
    mid=(h+l)//2
    if c[mid]>top:
      h=mid
    else:
      l=mid
  BtoC[i]+=BtoC[i+1]+n-h #according to B,C patten
ans=0
for i in range(n):
  ans+=BtoC[AtoB[i]]
print(ans)

Measured memory_bytes: 23908
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string s;
    cin >> s;
    int ans = 0;
    for (const char c : s)
    {
        if (c == '1') ++ans;
    }
    cout << ans << endl;
}


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

template <typename T>
void print_vector(vector<T>& vec) {
    cout << "print_vector -> ";
    for(int i=0; i<vec.size(); i++) {
        if(i == vec.size()-1) {
            cout << vec[i] << endl;
        }
        else {
            cout << vec[i] << " ";
        }
    }
    return;
}

int main() {

    long long x;
    cin >> x;

    for(long long A = -200; A < 200; A++) {
        for(long long B = -200; B < 200; B++) {
            long long A5 = A * A * A * A * A;
            long long B5 = B * B * B * B * B;

            if(A5 - B5 == x) {
                cout << A << " " << B << endl;
                return 0;
            } 
        }
    }

    return 0;
}

Measured memory_bytes: 3584
s = list( input() )

max_cnt = 0
cnt = 0
for c in s:
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        cnt += 1
        if max_cnt < cnt:
            max_cnt = cnt
    else:
        cnt = 0

print(max_cnt)

Measured memory_bytes: 38256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
#include <limits.h>
#include <queue>
#include <unordered_map>
#include <sstream>      // std::ostringstream
#include <bitset>
#include <iomanip>
#include <functional>
#include <set>
#include <list>

#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;
const long long INF = 1LL << 60;

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

template <typename T>
void DisplayAnswer(const T& v) {
	cout << v << endl;
}
template <typename T>
void DisplayAnswers(const vector<T>& vs) {
	for (const auto& v : vs) {
		cout << v << endl;
	}
}

template <typename T>
void DisplayAnswerOneLine(const vector<T>& vs) {
	for (const auto& v : vs) {
		cout << v << ' ';
	}
	cout << endl;
}


std::vector<std::string> split(const std::string &str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}



template<class T>
void chmin(T& a, T b) {
	if (a > b) {
		a = b;
	}
}


// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}


void DebugPrint(const vector<ll>& vec) {
	cout << "{";
	for (auto itr = vec.begin(); itr != vec.end(); ++itr) {
		cout << *itr << ",";
	}
	cout << "}" << endl;
}

// valueが2のx乗以下である計算
ll calc2x(ll value) {
	ll n = 0;
	while (value > 0) {
		value /= 2;
		++n;
	}
	return n;
}
int main(void) {

	map<ll, ll> map;
	ll N;
	cin >> N;

	for (ll i = 0; i < N; ++i) {
		ll n;
		cin >> n;
		map[n]++;
	}

	ll count = 0;
	for (auto& m : map) {
		if (m.second % 2) {
			count++;
		}
	}
	DisplayAnswer(count);
	return 0;
}


Measured memory_bytes: 9368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;


ll i;


int main(){
    ll N,K,Q;
    cin>>N>>K>>Q;
    V A(Q);
    rep(i,Q)cin>>A.at(i);

    V point(N);
    rep(i,Q)point.at(A.at(i)-1)++;

    rep(i,N){
        if(K-Q+point.at(i)>0)cout<<"Yes";
        else cout<<"No";
        cout<<endl;
    }
}


Measured memory_bytes: 2176
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  vector<int> h;
  rep(i, 10){
    int x;
    cin >> x;
    h.pb(x);
  }
  sort(h.begin(), h.end());
  cout << h[9] << endl;
  cout << h[8] << endl;
  cout << h[7] << endl;
	return 0;
}



Measured memory_bytes: 3032
alphabet = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
S = [alphabet.index(x) for x in s]
K = int(input())
tmp = K
i = 0
while i < len(S) and tmp > 0:
  if S[i] != 0 and 26-S[i] <= tmp:
    tmp -= 26-S[i]
    S[i] = 0
  i += 1
if tmp > 0:
  S[-1] = (S[-1]+tmp)%26
print("".join([alphabet[x] for x in S]))


Measured memory_bytes: 51212
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll MOD = 1000000007;
const ll N=1e5+9;
int main()
{
    FASTINOUT;
    int x,y;
    cin>>x>>y;
    ll mn=1e9;
    for (int i=1;i<=100000;i++){
        if ((int)(i*0.08)==x&&(int)(i*0.1)==y)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    ll n;
    cin >> n;
    string slime;
    cin >> slime;
    ll ans=1;
    REP(i,n-1)if(slime.at(i)!=slime.at(i+1))ans++;
    cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<iterator>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<queue>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<stack>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
*/
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define INFLL 0x3fffffffffffffffLL
#define INF 0x3f3fffff
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
typedef long long int ll;
typedef double dd;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const ll MOD=1000000007;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n';
#define DD(x,y) cerr<<"DEBUG:("<<#x<<","<<#y<<") are: "<<x<<" "<<y<<'\n';
/////////////////// GLOBAL VARIABLES ////////////////////////////
vector<vector<int>> adj; vector<bool> vis;
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
/////////////////// FUNCTIONS ////////////////////////////////////
inline ll mexp(ll x,ll n,ll m){ll res=1;while(n){if(n&1)res=(res*x)%m;n>>=1;x=((x%m)*(x%m))%m;}return res;}
bool ispow2(ll x){ return x && (!(x&(x-1)));}
ll gcd(ll x, ll y){ if(x==0 || y==0) return x+y; else return gcd(y%x,x);}

/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
  cout<<fixed;cerr<<fixed; cout<<setprecision(8); cerr<<setprecision(3);

#ifdef DEBUG
  freopen("ip.txt","r",stdin); //freopen("op.txt","w",stdout);
  clock_t tStart = clock();
#endif

  int n; cin>>n;
  cout<<"AB"<<("CD"[n/1000]);


#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
#endif
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n"
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v;
    int a, b, c, r;
    string s;
    cin >> s;
    if((s[2]==s[3]) && (s[4]==s[5])) Yes;
    else No;
   bye;

}



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

const int maxn = 1e5+100;
int h[maxn],dp[maxn];

int main() {
	int N;
	scanf("%d",&N);
	for(int i=1; i<=N; i++) scanf("%d",&h[i]);
	dp[1] = 0,dp[2] = abs(h[2]-h[1]);
	for(int i=3; i<=N; i++) dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
	printf("%d\n",dp[N]);
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	ll N, ans=0;
	ll A[100005], B[100005];

	cin >> N;
	rep(i,N) cin >> A[i] >> B[i];

	vector<pll> v;
	rep(i,N) v.emplace_back(A[i] + B[i], i);

	sort(all(v));
	reverse(all(v));

	rep(i,N){
		if( i%2 == 0 ) ans += A[v[i].Y];
		else ans -= B[v[i].Y];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
ll n,W,w[100],v[100],dp[110][310][110]={};
int main(void){
    ll ans=0;
    cin>>n>>W;
    for(int i=0;i<n;i++) cin>>w[i]>>v[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<300;j++){
            for(int k=0;k<n;k++){
                dp[i+1][j][k+1]=dp[i][j][k+1];
                if(w[i]-w[0]<=j) dp[i+1][j][k+1]=max(dp[i+1][j][k+1],dp[i][j-(w[i]-w[0])][k]+v[i]);
                if((k+1)*w[0]+j<=W) ans=max(ans,dp[i+1][j][k+1]);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 29776
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;



int main(){
	int n, v[20], c[20],sum=0;

	cin >> n;
	rep(i, n)cin >> v[i];
	rep(i, n)cin >> c[i];
	rep(i,n){
		if (v[i] > c[i])sum += v[i] - c[i];

	}
	cout << sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;


using ll = long long;

void solve() {
	ll N, A, B;

	cin >> N >> A >> B;

	ll s = A + B;
	ll m = N / s;
	ll r = N - (m * s);

	ll ar = min(r, A);

	ll count = A * m + ar;

	cout << count << endl;
}

int main() {

	solve();	
}

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

const int N = 100005, M = 100005, inf = 1000000009;
const long long mod = 1000000007ll;

template <class T>
void read (T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}

template <class T>
void write (T x) {
	if (x < 0) putchar('-'), write(-x);
	else if (x < 10) putchar(x + '0');
	else write(x / 10), putchar(x % 10 + '0');
}

int n, m, cnt1 = 0, cnt2 = 0, x[N], y[M];
struct node {
	int a, b;
	bool operator < (node rhs) const {
		if (a < rhs.a) return true;
		else if (a > rhs.a) return false;;
		return b > rhs.b;
	}

	bool operator == (node rhs) const {
		return a == rhs.a && b == rhs.b;
	}
} vec[N];
vector<int> tmp;

long long tree[N];
int lowbit (int x) {
	return x & -x;
}
void add (int x, long long val) {
	for (; x <= cnt2; x += lowbit(x)) tree[x] = (tree[x] + val) % mod;
}
long long query (int x) {
	long long res = 0ll;
	for (; x; x ^= lowbit(x)) res = (res + tree[x]) % mod;
	return res;
}

int main () {
	read(n), read(m);
	for (int i = 1; i <= n; i++) read(x[i]);
	for (int i = 1; i <= m; i++) read(y[i]);

	for (int i = 1; i <= n; i++) {
		int pos = lower_bound(y + 1, y + m + 1, x[i]) - y;
		if (pos > 1 && pos <= m) {
			vec[cnt1].a = x[i] - y[pos - 1], vec[cnt1].b = y[pos] - x[i];
			cnt1++;
		}
	}
	sort(vec, vec + cnt1);
	cnt1 = unique(vec, vec + cnt1) - vec;

	tmp.push_back(-inf);
	for (int i = 0; i < cnt1; i++) tmp.push_back(vec[i].b);
	sort(tmp.begin(), tmp.end());
	cnt2 = unique(tmp.begin(), tmp.end()) - tmp.begin();

	for (int i = 1; i <= cnt2; i++) tree[i] = 0;
	add(1, 1ll);
	for (int i = 0; i < cnt1; i++) {
		int pos = lower_bound(tmp.begin(), tmp.begin() + cnt2, vec[i].b) - tmp.begin();
		add(pos + 1, query(pos));
	}

	write(query(cnt2)), putchar('\n');
	return 0;
}

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

namespace abc_153b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            Monster Monster1 = new Monster(int.Parse(input[0]));
            CommonRaccoon CR1 = new CommonRaccoon(int.Parse(input[1]));

            for(int i = 0; i < CR1.LethalWeapon; i++)
            {
                Monster1.HP = battle(Monster1.HP, CR1.LWAttack[i]);
            }

            if (Monster1.HP <= 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

            Console.Read();

        }
        static public int battle(int HP,int Attack)
        {
            HP -= Attack;
            return HP;
        }
    }
    /// <summary>
    /// モンスターのクラス
    /// </summary>
    class Monster
    {
        /// <summary>
        /// モンスターのコンストラクタ
        /// </summary>
        /// <param name="hp"></param>
        internal int HP { get; set; }
        public Monster(int hp)
        {
            this.HP = hp;
        }

       　
    }
    /// <summary>
    /// アライグマのクラス
    /// </summary>
    class CommonRaccoon
    {
        internal int LethalWeapon { get; set; }
        internal int[] LWAttack;
        public CommonRaccoon(int LWtype)
        {
            this.LethalWeapon = LWtype;
            this.LWAttack = new int[LethalWeapon];

            string[] number = Console.ReadLine().Split(' ');

            for (int i = 0; i < LethalWeapon; i++)
            {
                LWAttack[i] = int.Parse(number[i]);
            }

        }
    }   
}


Measured memory_bytes: 16480
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
	
	string str1, str2;
	
	while(true){
		
		cin >> str1;
		
		if(cin.eof()){
			break;
		}
		
		cin >> str2;
		
		int ans, len;
		ans = 0;
		
		int s1, s2;
		s1 = str1.size();
		s2 = str2.size();
		
		for(int off_ = -s1; off_ < s2; off_++){
			len = 0;
			for(int j = max(0, off_); j < min(s1 + off_, s2) ; j++){
				if(str1[j - off_] == str2[j]){
					len++;
				}else{
					len = 0;
				}
				if(ans < len){
					ans = len;
				}
			}
		}
		
		printf("%d\n", ans);
		
	}
	return 0;
}

Measured memory_bytes: 1204
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    S = list(input())

    left = [0] * (len(S) + 1)

    right = [0] * (len(S) + 1)

    for i in range(len(S)):
        if S[i] == '<':
            left[i + 1] += 1 + left[i]

    for i in range(len(S) - 1, -1, -1):
        if S[i] == '>':
            right[i] = right[i + 1] + 1

    ans = [0] * (len(S) + 1)
    for i in range(len(S) + 1):
        ans[i] = max(left[i], right[i])
    print(sum(ans))

run()




Measured memory_bytes: 100476
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  string s;
  string t;
  cin >> s>>t;
  int ans = n;
  for(int i = 0;i<n;i++){
    if(s.substr(i,n-i) == t.substr(0,n-i)){
      break;
    }
    else{
      ans++;
    }
  }
  cout <<ans;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int map[1000];

int main() {
    int N, M, s, curr, sum;
    bool isOver;
    for (; ;) {
        scanf("%d %d", &N, &M);
        if (N == 0 && M == 0) break;
        for (int i = 0; i < N; i++) scanf("%d", &map[i]);
        isOver = false;
        curr = sum = 0;
        for (int i = 0; i < M; i++) {
            scanf("%d", &s);
            if (!isOver) {
                curr += s;
                if (curr >= N-1) isOver = true;
                else {
                    curr+= map[curr];
                    if (curr >= N-1) isOver = true;
                }
                sum++;
            }
        }
        printf("%d\n", sum);
    }
    return 0;
}



Measured memory_bytes: 2672
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int MOD=1000000007;
int INF=100100100100100;
int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int kaijou(int a)
{
	int ans=1;
	for(int i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}			
	return ans;
}

/*int combi(int a,int b)
{
	int ret=1;
	for(int i=1;i<=b;i++)
	{
		ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
	}
	return ret;
}*/
/*
const int MAX_a=200010;
int cb[MAX_a+1]
void combi(int a,int b)
{
    int ret=1;
    cb[0]=1;
    for(int i=1;i<=b;i++)
    {
	ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
        cb[i]=ret;
    }
	
}*/

vector<P> prime_factorize(int N)
{
	vector<P> res;
	for(int a=2;a*a<=N;a++)
	{
		if(N%a!=0)continue;
		int ex=0;
		while(N%a==0)
		{
			ex++;N/=a;
		}
		res.push_back(P(a,ex));
	}
	if(N!=1)res.push_back(P(N,1));
	return res;
}

//ここから書く
int po(int n){
  if(n==0)return 0;
  return po(n/10)+(n%10);
}
signed main(){
  int n;cin>>n;
  if(n%po(n)==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n,m;
    cin >> n >> m;
    int k[1000];
    int s[1000][1000];
    int p[1000];
    for(int i=0; i<m; i++){
        cin >> k[i];
        for(int j=0;j<k[i];j++){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    for(int i=0; i<m; i++){
        cin >> p[i];
    }

        int ans = 0;
        int on[10];
        for(int i=0; i<pow(2,n);i++){
            int tmp = i;
            for(int j=0;j<n;j++){
                on[j] = tmp%2==1;
                tmp/=2;
            }
            bool flag = true;
            for(int j=0; j<m;j++){
                int cnt_on=0;
                for(int kk=0; kk<k[j];kk++){
                    if(on[s[j][kk]]==1) cnt_on++;
                }
                if(cnt_on%2 != p[j]){
                    flag = !flag;
                    break;
                }
            }
            if(flag) ans++;
        }
        cout << ans;


  return 0;
}


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

#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 sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int dp[11][100005];
int p[11][11];

int main() {
	int n, d, x; cin >> n >> d >> x;

	for (int i = 1; i <= d; i++)
		for (int j = 1; j <= n; j++)
			cin >> p[i][j];

	int cmax = x;

	for (int i = 1; i <= d - 1; i++) {
		dp[i][0] = 0;
		for (int j = 1; j <= cmax; j++)
			dp[i][j] = -1;
		
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k + p[i][j] <= cmax; k++) if (dp[i][k] != -1) {
				dp[i][k + p[i][j]] = max(dp[i][k + p[i][j]], dp[i][k] + p[i + 1][j]);
			}
		}

		int tmrmax = 0;
		for (int k = 0; k <= cmax; k++)
			tmrmax = max(tmrmax, dp[i][k] + (cmax - k));

		cmax = tmrmax;
	}
	
	cout << cmax << endl;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll solve(ll n)
{
    ll m=n%4;
    if(m==0)return n;
    if(m==1)return 1;
    if(m==2)return n+1;
    if(m==3)return 0;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll l,r;
    cin>>l>>r;
    cout<<(solve(r)^solve(l-1))<<endl;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef long long ll;
const ll INF = 1e17;
ll w[205][205];
int n,m,R;
int r[10];
ll dp[1 << 8][8];
int main() {
  cin >> n >> m >> R;
  for(int i = 0; i < R; i++) {
    cin >> r[i];
    r[i]--;
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(i != j) w[i][j] = INF;
    }
  }
    for(int i = 0; i < m; i++) {
      int a,b;
      ll c;
      cin >> a >> b >> c;
      a--; b--;
      w[a][b] = c;
      w[b][a] = c;
    }

    for(int k = 0; k < n; k++) {
      for(int i = 0; i < n; i++) {
	for(int j = 0; j < n; j++) {
	  w[i][j] = min(w[i][j],w[i][k] + w[k][j]);
	}
      }
    }
    
    for(int i = 0; i < (1 << 8); i++) {
      for(int j = 0; j < 8; j++) {
	dp[i][j] = INF;
      }
    }
    for(int i = 0; i < R; i++) dp[(1 << i)][i] = 0;
    
    for(int i = 1; i < (1 << R); i++) {
      for(int j = 0; j < R; j++) {
	if(dp[i][j] == INF) continue;
	for(int k = 0; k < R; k++) {
	  if((i >> k) & 1) continue;
	  int s = (1 << k);
	  dp[i | s][k] = min(dp[i | s][k],dp[i][j] + w[r[j]][r[k]]);
	}
      }
    }
    
    ll ans = INF;
    for(int i = 0; i < R; i++) ans = min(ans,dp[(1 << R) - 1][i]);
    cout << ans << endl;
}













	


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
int main()
{
    char s[15],ss[15];
    while(~scanf("%s",s))
    {
       int i,j=-1;
       for(i=0;s[i]!='\0';i++)
      {
          if(s[i]=='B')
          {
              if(j>=0)
                j--;
          }
           else
            ss[++j]=s[i];
      }
      ss[++j]='\0';
       printf("%s\n",ss);
        memset(s,0,sizeof(s));
        memset(ss,0,sizeof(ss));
    }
    return 0;
}



Measured memory_bytes: 128
n,a,b,c = map(int,input().split())
l = [int(input()) for i in range(n)]
def dfs(cnt,A,B,C):
    if cnt == n:
        if min(A,B,C) == 0:
            return float('inf')
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)-30
    else:
        ret1 = dfs(cnt+1,A+l[cnt],B,C)+10
        ret2 = dfs(cnt+1,A,B+l[cnt],C)+10
        ret3 = dfs(cnt+1,A,B,C+l[cnt])+10
        ret4 = dfs(cnt+1,A,B,C)
        return min(ret1,ret2,ret3,ret4)

print(dfs(0,0,0,0))


Measured memory_bytes: 45660
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll,ll>
#define PP pair<P,P>
using namespace std;

int main(){
    ll a,v; cin >> a >> v;
    ll b,w; cin  >> b >> w;
    ll t; cin >> t;
    ll d=abs(a-b);
    ll s=abs(v-w);
    ll dd=s*t;
    if(v<=w){
        cout << "NO" << endl;
        return 0;
    }
    else if(dd<d){
        cout << "NO" << endl;
    }
    else cout << "YES" << endl;
return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

int other(int a, int b) {
  vi v(3);
  v[a] = 1;
  v[b] = 1;
  rep(i, 3) {
    if(v[i] == 0) {
      return i;
    }
  }   
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  string SSS;
  cin >> SSS;
  
  vi S(N);
  rep(i, N) {
    S[i] =
      SSS[i] == 'R' ? 0 : (SSS[i] == 'G' ? 1 : 2);
  }
  
  vvll acc(3, vll(N+1));
  rep(i, N) {
    rep(j, 3) {
      acc[j][i+1] = acc[j][i] + (S[i] == j ? 1 : 0);
    }
  }
  
  ll s = 0;
  for(int i=0; i<N-3; i++) {
    for(int k=i+3; k<N; k++) {
      if(S[k] != S[i]) {
        //start候補
        //間の数
        int ocol = other(S[k], S[i]);
        ll ct = acc[ocol][k] - acc[ocol][i+1];
        if((k - i) % 2 == 0 && S[(i + k) / 2] == ocol) {
          ct --;
        }
        s += ct;
      }
    }
  }
  
  fin(s);
}

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

int main() {
  ll n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }

  int num=a[0],count=0;
  while(count<=n) {
    count++;
    if(num==2) {
      break;
    }
    num=a[num-1];
  }
  if(count==n+1) count=-1;
  cout << count << endl;
}

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

const int MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N)
    {
        int index;
        cin >> index;
        a.at(i) = index - 1;
    }

    int button = 0;
    bool possible = false;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans++;
        button = a.at(button);
        if (button == 1) {
            possible = true;
            break;
        }
    }

    if (!possible)
        ans = -1;

    cout << ans << endl;
}

Measured memory_bytes: 640
def main():
    import sys
    input = sys.stdin.readline

    a, b, c = map(int, input().split())

    if a == b == c:
        print('No')
    elif a != b and b != c and c != a:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256