akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
#include <sstream>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define int long long

using namespace std;

int toint(string s) {
	stringstream ss(s);
	int ret;
	ss >> ret;
	return ret;
}

string s;
int c;

string num() {
	string r;
	if (s[c] >= '0' && s[c] <= '9') {
		r += s[c];
		c++;
		r += num();
		return r;
	}
	else {
		return "";
	}
}

set<int> solve(vector<set<int>> &v, vector<char> &o) {
	int n = v.size();
	vector<bool> f(n, false);

	vector<int> t(n - 1);
	rep(i, n - 1) {
		t[i] = i;
	}

	set<int> re;
	do {
		auto tv = v;
		auto to = o;
		auto tt = t;

		rep(i, n - 1) {
			set<int> se;
			for (auto j : tv[tt[i]]) {
				for (auto k : tv[tt[i]+1]) {
					if (to[tt[i]] == '+') {
						se.insert(j + k);
					}
					if (to[tt[i]] == '-') {
						se.insert(j - k);
					}
					if (to[tt[i]] == '*') {
						se.insert(j * k);
					}
					if (to[tt[i]] == '/') {
						if (k != 0) {
							se.insert(j / k);
						}
					}
				}
			}
			
			to.erase(to.begin() + tt[i]);
			tv.erase(tv.begin() + tt[i] + 1);
			tv.erase(tv.begin() + tt[i]);
			tv.insert(tv.begin() + tt[i], se);
			for (int j = 0; j < tt.size(); j++) {
				if (tt[i] < tt[j]) {
					tt[j]--;
				}
			}
		}
		for (auto i : tv[0]) {
			re.insert(i);
		}

	} while (next_permutation(t.begin(), t.end()));

	return re;
}

//exprテ」ツ?ョテァツオツづ、ツコツ?・ツ慊ーテァツつケテ」ツ?ィテァツオツ?」ツ?ソテ・ツ青暗」ツつ湘」ツ?崚」ツ?ョテヲツ閉ー
set<int> fc() {
	if (s[c] == '(') {
		c += 1;
		vector<set<int>> v;
		v.push_back(fc());
		vector<char> o;

		while (s[c] != ')') {
			o.push_back(s[c]);
			if (s[c] == '+') {
				c++;
				v.push_back(fc());
				continue;
			}
			if (s[c] == '-') {
				c++;
				v.push_back(fc());
				continue;
			}
			if (s[c] == '*') {
				c++;
				v.push_back(fc());
				continue;
			}
			if (s[c] == '/') {
				c++;
				v.push_back(fc());
				continue;
			}
		}
		c += 1;
		return solve(v, o);
	}
	if (s[c] >= '0' && s[c] <= '9') {
		int t = toint(num());
		set<int> re;
		re.insert(t);
		return re;
	}
}

signed main(){
	while (cin >> s && s != "#") {
		c = 0;
		s = "(" + s + "))";
		cout << fc().size() << endl;
	}
	return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n, x;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> x;
        v[i] = x;
    }
    
    //sort(v.begin(), v.end());
    int cnt = 0;
    for (int i = 1; i < n; i++) {
        if (v[i-1] == v[i]) {
            cnt++;
            v[i] = -1;
        }
        
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long int LL;
const int Max_N(100050);
const int Max_M(100050);

namespace io
{
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush (){fwrite (obuf, 1, oS - obuf, stdout);oS = obuf;}
	inline void putc (char x){*oS ++ = x;if (oS == oT) flush ();}
	template <class I>
	inline void gi (I &x) {for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;}
	template <class I>
	inline void print (I x){
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;while(x) qu[++ qr] = x % 10 + '0',  x /= 10;while (qr) putc (qu[qr--]);}
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io::gi;
using io::putc;
using io::print;

int N, M, B[Max_N], C[Max_N], P[Max_N], Father[Max_N], X[Max_N], Head[Max_N], Total, To[Max_M << 1], Next[Max_M << 1];
LL F[Max_N], Sum[Max_N];

inline bool comp(int a, int b)
{
	return C[a] < C[b];
}

inline void Add_Edge(int s, int t)
{
	++Total, To[Total] = t, Next[Total] = Head[s], Head[s] = Total;
}

int Get_Father(int x)
{
	return Father[x] == x ? x : Father[x] = Get_Father(Father[x]);
}

int main()
{
	gi(N), gi(M);
	for (int i = 1, a;i <= N;++i)
		gi(a), gi(B[i]), C[i] = max(a - B[i], 0), P[i] = i;
	for (int u, v;M--;)
		gi(u), gi(v), Add_Edge(u, v), Add_Edge(v, u);
	sort(P + 1, P + 1 + N, comp);
	for (int pos = 1, u;pos <= N;++pos)
	{
		u = P[pos], Father[u] = u, Sum[u] = B[u], X[0] = 0;
		for (int i = Head[u], v;i;i = Next[i])
			if (Father[v = To[i]])
				X[++X[0]] = Get_Father(v);
		sort(X + 1, X + 1 + X[0]), X[0] = unique(X + 1, X + 1 + X[0]) - (X + 1);
		for (int i = 1;i <= X[0];++i)
			Sum[u] += Sum[X[i]], Father[X[i]] = u;
		if (!X[0])
			F[u] = B[u] + C[u];
		else
		{
			F[u] = 0X3F3F3F3F3F3F3F3FLL;
			for (int i = 1;i <= X[0];++i)
				F[u] = min(F[u], Sum[u] - Sum[X[i]] + max(C[u] * 1LL, F[X[i]]));
		}
	}
	print(F[Get_Father(1)]);
	return 0;
}

Measured memory_bytes: 9856
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<iostream>
//#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	string S, T;
	cin >> S >> T;
	int N = S.size();
	int M = T.size();

	short dp[3001][3001];
	dp[0][0] = 0;
	rep1(i, N) dp[i][0] = 0;
	rep1(j, M) dp[0][j] = 0;
	rep(i, N) {
		rep(j, M) {
			dp[i + 1][j + 1] = (S[i] == T[j] ? dp[i][j] + 1 : max(dp[i][j + 1], dp[i + 1][j]));
		}
	}
	char kotae[3000];
	int k = dp[N][M];
	int i = N, j = M;
	while (k > 0) {
		while (i > 0 && dp[i - 1][j] == dp[i][j]) i--;
		while (j > 0 && dp[i][j - 1] == dp[i][j]) j--;
		i--;
		j--;
		kotae[--k] = S[i];
	}
	fwrite(kotae, 1, dp[N][M], stdout);

	Would you please return 0;
}

Measured memory_bytes: 17920
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define umap unordered_map
#define uset unordered_set
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(s, n, a) for(int i = s; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES\n" : "NO\n")
#define mod(a, b) (b + (a % b)) % b
#define MOD (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

void add_self (int& a, int b){ a += b; if (a >= MOD) a -= MOD; }
//-------------------------------------------------------------------------------------------------------//

void solve(){
    int n, r;
    cin >> n >> r;
    if(n >= 10) cout << r;
    else{
        cout << r + 100 * (10 - n);
    }
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(){
  int N;
  cin >> N;
  char hina[N];
  for (int i = 0; i < N; i++) {
    cin >> hina[i];
  }
  for (int j = 0; j < N; j++) {
    if(hina[j] == 'Y'){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

const int maxn = 1e+5 + 5;
int f[30][maxn];

void solve()
{
    int n, C;
    cin >> n >> C;
    for(int i = 0; i < n; i++)
    {
        int s, t, c;
        cin >> s >> t >> c;
        s--, t--, c--;
        for(int k = s; k <= t; k++)
        {
            f[c][k] = 1;
        }
    }
    
    int res = 0;
    for(int i = 0; i < maxn; i++)
    {
        int temp = 0;
        for(int k = 0; k < 30; k++)
        {
            temp += f[k][i];
        }
        res = max(temp, res);
    }
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 12032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		int price = 0;
		int max = 0;
		for(int i = 0;i < N;i++) {
			int in = s.nextInt();
			price += in;
			max = Math.max(max, in);
		}
		System.out.println(price - max/2);
		
	}

}


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

class Cmondai
{
    static void Main()
    {
        var N = Int64.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var array = new long[N];
        for (long i=0;i<N;++i)
        {
            array[i]= A[i] - (i + 1);
        }
        array=array.OrderBy(x => x).ToArray();
        var num = (N + 1) / 2;
        var ans = 0L;
        if (N % 2 == 0) num = (array[num - 1] + array[num]) / 2;
        else num = array[num - 1];
        ans = GetAns(N, A, num);
        Console.WriteLine(ans);
    }
    static long GetAns(long N,long[] A,long num)
    {
        var ans = 0L;
        for (long i = 0; i < N; ++i)
        {
            ans += Math.Abs(A[i] - (i + 1 + num));
        }
        return ans;
    }
}

Measured memory_bytes: 43200
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int gcd(int a,int b){
    while(b^=a^=b^=a%=b);
    return a;
}
int main(){
    int k;
    long long int sum=0;
    cin>>k;
    for(int a=1;a<=k;a++){
        for(int b=1;b<=k;b++){
            for(int c=1;c<=k;c++)
                sum+=gcd(a,gcd(b,c));
        }
            }
    
    cout<<sum;

}

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

using namespace std;

int main() {
 	string a, b;
  cin >> a >> b;
  int lena = a.length();
  int lenb = b.length();
  int mmin = 1 << 30;
  for (int i = 0; i < lena - lenb + 1; i++) {
    int temp = 0;
   	 for (int j = 0; j < lenb; j++) {
       if (a[i + j] != b[j]) 
         temp++;
     }
    mmin = min(mmin, temp);
  }
  cout << mmin << endl;
  return 0;
}


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

using namespace std;

int main() {

	vector<int> arr(3);

	int five = 0, seven = 0;

	for (int i = 0; i < 3; i++) {

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

		if (a == 5) five++;
		if (a == 7) seven++;

	}

	if (five == 2 && seven == 1) printf("YES");
	else printf("NO");
		

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    

    ll n;
    cin >> n;
    vector <ll> b;
    for (ll i=0;i<n-1;i++){
        ll tmp;
        cin >> tmp;
        b.push_back(tmp);
    }
    ll ans = b[0];
    for (ll i=1;i<n;i++){
        if(i<n-1){
            ans += min(b[i], b[i-1]);
        }else{
            ans += b[i-1];
        }
    }
    cout << ans << endl;
}

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

int main() {
  int A, B, C, K, M=0;
  cin >> A >> B >> C >> K;
  if (K <= A) {
    M = K;
  } else if (K <= A+B) {
    M = A;
  } else {
    M = A - (K - A - B);
  }
  cout << M << endl;
}


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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

#define N 2001

typedef long long int ll;
int dp[N];
const int MOD = 1e9+7;

int ways(int n) {
	if (n == 0)
		return 1;

	if (n < 0)
		return 0;

	if (dp[n] != -1)
		return dp[n];

	int c = 0;

	for (int k = 3; k <= n; k++)
		c = ((ll)c + (ll)ways(n-k)) % MOD;

	return dp[n] = c;
}

int main() {

	IOS

	int n;
	cin >> n;

	memset(dp, -1, sizeof(dp));

	cout << ways(n);

	return 0;
}

Measured memory_bytes: 3660
nn,xx=map(int,input().split())
def f(n,x):
  if x==0:
    return 0
  if n==0:
    return 1
  if x==2**(n+2)-3:
    return 2**(n+1)-1
  b=2**(n+1)-3
  u=min(b,max(0,x-2-b))
  l=min(x-1,b)
  return f(n-1,u)+(1 if x>b+1 else 0)+f(n-1,l)
print(f(nn,xx))

Measured memory_bytes: 9196
import math


def get_sieve_of_eratosthenes(n):# エラトステネスのふるい(O(NloglogN)). ~nまでの素数をリストで返す.
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


Q = int(input())
ls = [0]
prime = set(get_sieve_of_eratosthenes(10**5 + 10))

output = []
for i in range(10**5+10):
    if (i in prime) & (int((i+1)/2) in prime):
        ls.append(ls[-1]+1)
    else: 
        ls.append(ls[-1])

for q in range(Q):
    l, r = map(int, input().split())
    output.append(ls[r+1]-ls[l])
print(*output, sep="\n")



Measured memory_bytes: 11164
A,B = gets.split.map(&:to_i)

ans = 1
n = A.gcd(B)
i = 2
while i*i <= n
  if n % i == 0
    n /= i while n % i == 0
    ans += 1
  end
  i += 1
end
ans += 1 if n != 1
puts ans

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

ll num_of_ways(vector<ll>&capacity, ll n, ll k)
{
	vector<vector<ll>>dp(n + 2, vector<ll>(k + 2));
	for (ll j = 0; j <= k; j++)
	{
		if (j > capacity[1])
			dp[1][j] = 0;
		else
			dp[1][j] = 1;
	}
	for(ll j=0;j<=k;j++)
	{
		dp[0][j]=0;
	}
	for (ll i = 2; i <= n; i++)
	{
		for (ll j = 0; j <= k; j++)
		{
			if (j == 0)
			{
				dp[i][j] = dp[i - 1][j];
			}
			else if (j - 1 - capacity[i] >= 0)
			{
				//MOD plus isiliye kiya kyunki agar result negative aaya to MOD kaise hoga
				dp[i][j] = (MOD+dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1 - capacity[i]]) % MOD;
			}
			else
			{
				dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
			}
		}
	}
	return dp[n][k];
}

int main()
{
	ll n;
	cin >> n;
	ll k;
	cin >> k;
	vector<ll>capacity(n + 1);
	for (ll i = 1; i <= n; i++)
	{
		ll d;
		cin >> d;
		capacity[i] = d;
	}
	cout << num_of_ways(capacity, n, k);
	return 0;
}

Measured memory_bytes: 83856
package main

import (
	"fmt"
	"io"
	"os"
)

var (
	sc   = NewScanner(os.Stdin)
	n    = sc.Int()
	k    = sc.Int64()
	tels = make([]*Teleporter, n+1)
)

func main() {
	for i := range tels[1:] {
		tels[i+1] = &Teleporter{
			id:   i + 1,
			dest: sc.Int(),
		}
	}

	fmt.Println(tels[1].Dest(0))
}

type Teleporter struct {
	id, dest int
	step     int64
	checked  bool
}

func (t *Teleporter) Dest(step int64) int {
	if t.checked {
		k %= step - t.step
	}
	if k <= 0 {
		return t.id
	}
	t.checked = true
	t.step = step
	k--
	return tels[t.dest].Dest(step + 1)
}

// generated by https://github.com/murosan/gollect

type Scanner struct {
	r     io.Reader
	buf   []byte
	delim byte
	size, eof,
	start, end int
}

func NewScanner(r io.Reader) *Scanner { return NewScannerSize(r, 4096) }
func NewScannerSize(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:     r,
		buf:   make([]byte, size),
		delim: ' ',
		size:  size, start: size, end: size,
	}
}

func (s *Scanner) Int() int     { return ParseInt(s.bytes()) }
func (s *Scanner) Int64() int64 { return ParseInt64(s.bytes()) }

func (s *Scanner) bytes() []byte { b, _ := s.next(); return b }
func (s *Scanner) next() (b []byte, size int) {
	for n := 0; ; {
		for i := s.end; i < s.size; i++ {
			if s.buf[i] == s.delim || s.buf[i] == '\n' || i == s.eof {
				b, size = s.buf[s.start:i], i-s.start
				s.start, s.end = i+1, i+1
				return
			}
		}
		s.end = s.size
		if n++; n == 2 {
			panic("lack of buffer size")
		}
		s.read()
	}
}
func (s *Scanner) read() {
	copy(s.buf, s.buf[s.start:s.end])
	s.end -= s.start
	s.start = 0
	n, _ := s.r.Read(s.buf[s.end:])
	s.eof = s.end + n
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}

func ParseInt64(b []byte) (n int64) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int64(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}


Measured memory_bytes: 24860
import collections
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, M = map(int, input().split())
        pS = []
        for _ in range(M):
            tmp = input().split()
            pS.append((int(tmp[0]), tmp[1]))

        ac = 0
        wa = 0
        s_dict = collections.defaultdict(lambda: True)
        wa_dict = collections.defaultdict(int)
        for i in range(M):
            p, s = pS[i]
            if s_dict[p]:
                if s == "AC":
                    ac += 1
                    wa += wa_dict[p]
                    s_dict[p] = False
                else:
                    wa_dict[p] += 1

        print(*[ac, wa])


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 75100
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}

int main() {
	fast();

    /*NA – JEONG – MO – SA – JI – MI – DA – CHAE – TZU*/
    
    inps(h, n);
    inpv(a, n);
    ll sum = 0;
    for(auto i:a){
        sum+=i;
    }
    if(sum>=h){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const ll INF = 0X3f3f3f3f;
const int maxn = 1e5;
int dp[maxn],a[maxn];
int n;
int main() {
	cin>>n;
	cout<<n*n*n<<endl;
}

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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        string s1, s2;
        cin >>s1 >>s2;
        s2.pop_back();
        if (s1==s2)
                cout <<"Yes" <<endl;
        else
                cout <<"No" <<endl;
        return 0;
}


Measured memory_bytes: 3628
import java.io.*;
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] arr = new int[3];
    int max = 0;
    int maxInd = -1;
    for(int i = 0; i < 3; i++) {
      arr[i] = sc.nextInt();
      max = Math.max(arr[i], max);
      if(max == arr[i]) {
        maxInd = i;
      }
    }
    int K = sc.nextInt();
    arr[maxInd] *= Math.pow(2, K);
    System.out.println(arr[0] + arr[1] + arr[2]);
  }
}


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

int main(){
    int64_t W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << W*H/2.0 << " ";
    if(x*2 == W && y*2 == H) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<int, pii> pipii;
typedef vector<vector<ll>> matrix;

map<pii, vector<int>> edgesOut; // <vertex, color> -> out
vector<pii> edges[100005]; // <vertex, color>
bool seen[100005];
map<pii, int> dp;

void solve() {
  int n, m;
  cin >> n >> m;
  priority_queue<pipii> q; // <distance, <vertex, color>>
  while(m--) {
    int a, b, c;
    cin >> a >> b >> c;
    edges[a].push_back({b, c});
    edges[b].push_back({a, c});
    edgesOut[{a, c}].push_back(b);
    edgesOut[{b, c}].push_back(a);
    if(!dp.count({1, c})) {
      dp[{1, c}] = 1;
      q.push({-1, {1, c}});
    }
  }
  int ret = -1;
  while(!q.empty()) {
    pipii curr = q.top();
    q.pop();
    if(curr.second.first == n) {
      ret = -curr.first;
      break;
    }
    if(dp[curr.second] != -curr.first) continue;
    if(!seen[curr.second.first]) {
      seen[curr.second.first] = true;
      for(pii out: edges[curr.second.first]) {
        pii nextKey = out;
        if(!dp.count(nextKey) || dp[nextKey] > 1 - curr.first) {
          dp[nextKey] = 1 - curr.first;
          q.push({-dp[nextKey], nextKey});
        }
      }
    }
    if(edgesOut.count(curr.second)) {
      for(int out: edgesOut[curr.second]) {
        pii nextKey = {out, curr.second.second};
        if(!dp.count(nextKey) || dp[nextKey] > -curr.first) {
          dp[nextKey] = -curr.first;
          q.push({-dp[nextKey], nextKey});
        }
      }
    }
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 89648
N,T=map(int,input().split())
p=[]
for _ in range(N):
  c=list(map(int,input().split()))
  p.append(c)
ans=9999
for c in p:
  if c[1]<=T:
    if c[0]<ans:
      ans=c[0]
if ans==9999:
  print('TLE')
else:
  print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int *array;
    int n,i;
    
    scanf("%d",&n);
    n+=1;
    array = (int *)malloc(n * sizeof(int));
    for(i = 1; i < n; i++){
        scanf("%d",&array[i]);
    }
    for(i = 1; i < n; i++){
        printf("node %d: key = %d, ",i,array[i]);
        if(i/2<n && i/2>0){
            printf("parent key = %d, ",array[i/2]);
        }
        if(2*i > 0 && 2*i <n){
            printf("left key = %d, ",array[2*i]);
        }
        if(2 * i + 1 > 0 && 2 * i + 1 < n){
            printf("right key = %d, ",array[2*i + 1]);
        }
        printf("\n");
    }
    return 0;
}

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

const int N = 1e5 + 10;
int n, a, b;
int h[N], dp[N];

int main(){
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++){
		a = dp[i - 1] + abs(h[i] - h[i - 1]);
		b = dp[i - 2] + abs(h[i] - h[i - 2]);
		if (a > b)
		    dp[i] = b;
		else 
		    dp[i] = a;
	}
	cout << dp[n - 1];
}


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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void permute(ll n, vll &prm, vl loc, int idx) {
    if(loc.size() >= 1) {
        prm.pb(loc);
    }
    
    for(int i = idx; i <= n; i++) {
        loc.pb(i);
        permute(n, prm, loc, i + 1);
        loc.pop_back();
    }
}


pair<bool, ll> verify(vl &prm, ll x, vll &books, ll m) {
    vl skill(m, 0);
    ll ct = 0;
    for(int i = 0; i < prm.size(); i++) {
        ct += books[prm[i] - 1][0];
        for(int j = 1; j <= m; j++) {
            skill[j - 1] += books[prm[i] - 1][j];
        }
    }
    bool flag = true;
    for(int i = 0; i < skill.size(); i++) {
        if(skill[i] < x) {
            flag = false;
        }
    }
    
    return make_pair(flag, ct);
}

int main() {
	
	fastio;
    
    rd3(ll, n, m, x);
    
    vll books(n, vl(m + 1));
    vl skill(m, 0);
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j <= m; j++) {
            cin >> books[i][j];
        }
    }
    
    vll prm;
    vl loc;
    permute(n, prm, loc, 1);
    // deb(prm.size());
    // db2(prm);
    
    ll mnc = INT_MAX;
    FOR(i, 0, prm.size()) {
        pair<bool, ll> tp = verify(prm[i], x, books, m);
        if(tp.F) {
            mnc = min(mnc, tp.S);
        }
    }
    
    if(mnc == INT_MAX) {
        cout << -1;
    } else {
        cout << mnc;
    }
    
    
    return 0;
    
    
    
    
}

Measured memory_bytes: 3932
#include<iostream>
#include<string.h>
using namespace std;

char input[12];

int sisuu( int tei, int n ){
	int ans = 1;
	for( int i = 0; i < n; i++ ){
		ans *= tei;
	}
	return ans;
}

int Number( char *str ){
	int i,cnt = 0;
	int num = 0;
	for( i = strlen(str)-1; i >= 0; i-- ){
		//cout << "str[" << i << "] = " << str[i] << endl;
		num += sisuu(10,cnt) * (str[i] - '0');
		cnt++;
	}
	return num;
}

int main(){
	int i;
	int ans;
	
	cin >> input;
	ans = Number(input);
	
	while( cin >> input ){
		//cout << ans << endl;
		if( input[0] == '=' ){
			cout << ans << endl;
			break;
		}
		else if( input[0] == '+' ){
			cin >> input;
			ans += Number(input);
		}
		else if( input[0] == '-' ){
			cin >> input;
			ans -= Number(input);
		}
		else if( input[0] == '*' ){
			cin >> input;
			ans *= Number(input);
		}
		else if( input[0] == '/' ){
			cin >> input;
			ans /= Number(input);
		}
	}
	return 0;
}

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

  ll N , M ;
  ll ans = 0 ;
  cin >> N >> M ;
  vector<ll> A(N) ;
  vector<ll> B(N) ;
  rep(i,N) cin >> A.at(i) >> B.at(i) ;
  ll maxA = 0 ;
  rep(i,N) maxA = max(maxA,A.at(i)) ;
  sort(B.begin(), B.end(),greater<ll>() );
  rep(i,N){
    if( B.at(i) > maxA ){
      if( M > 0 ){
        ans++ ;
      	M -= B.at(i) ;
      }
    }
  }
  if( M > 0 ) ans += ( M + maxA - 1 )/maxA ;
  cout << ans << endl;
}

Measured memory_bytes: 1792
N,M = map(int,input().split())
SC = [list(map(int,input().split())) for _ in range(M)]
flag = 1
for i in range(1000):
  if len(str(i)) < N:
    continue
  flag = 1
  for s,c in SC:
    c = str(c)
    if str(i)[s-1] != c:
      flag = 0
  if flag == 1:
    print(i)
    exit()

print(-1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pii pair<int, int>
#define ll long long
using namespace std;
const int MAXN = 15;
const ll INF = 1e14;
pii p[MAXN];
ll v[MAXN];
int pow3[MAXN + 1];
ll ans[MAXN + 1], cost[MAXN];
ll disx[1 << MAXN][MAXN], disy[1 << MAXN][MAXN];
int numx[1 << MAXN], numy[1 << MAXN];
void sort_and_unique(vector<int>&vec) {
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
int main() {
    int n; scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %lld", &p[i].first, &p[i].second, &v[i]);
    }
    for (int sta = 0; sta < (1 << n); sta++) {
        vector<int>posx, posy;
        for (int i = 0; i < n; i++) {
            if (sta >> i & 1) {
                posx.push_back(p[i].first);
                posy.push_back(p[i].second);
            }
            int MINx = abs(p[i].first), MINy = abs(p[i].second);
            for (int j = 0; j < n; j++) if (sta >> j & 1) {
                MINx = min(MINx, abs(p[i].first - p[j].first));
                MINy = min(MINy, abs(p[i].second - p[j].second));
            }
            disx[sta][i] = MINx;
            disy[sta][i] = MINy;
        }
        sort_and_unique(posx); numx[sta] = posx.size();
        sort_and_unique(posy); numy[sta] = posy.size();
    }

    pow3[0] = 1;
    for (int i = 1; i <= n; i++) pow3[i] = pow3[i - 1] * 3; 
    for (int i = 0; i <= n; i++) ans[i] = INF;
    for (int sta = 0; sta < pow3[n]; sta++) {
        vector<ll>xaxis, yaxis;
        int sx = 0, sy = 0;
        for (int i = 0; i < n; i++) {
            int r = (sta / pow3[i]) % 3;
            if (r == 1) sx |= (1 << i);
            else if (r == 2) sy |= (1 << i);
        }
        ll res = 0;
        for (int i = 0; i < n; i++)
            res += v[i] * min(disx[sx][i], disy[sy][i]);
        int cnt = numx[sx] + numy[sy];
        ans[cnt] = min(ans[cnt], res);
    }

    for (int i = 1; i <= n; i++) ans[i] = min(ans[i - 1], ans[i]);
    for (int i = 0; i <= n; i++) printf("%lld\n", ans[i]);
    return 0;
}

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

int main(){
  long long n, p;
  cin >> n >> p;
  
  if(n == 1){
    cout << p << endl;
    return 0;
  }
  
  if(pow(2, n) > p){
    cout << 1 << endl;
    return 0;
  }
  
  long long ans = 1;
  for(long long i = 2; pow(i, n) <= p; i++){
    if(p % (long long)pow(i, n) == 0) ans = i;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		long t = sc.nextLong();
		long now = 0;
		long ans = t;
		for(int i=0; i<n; i++){
			long next = sc.nextLong();
			ans += Math.min(next-now,t);
			now = next;
		}
		System.out.println(ans);

		return;
	}
}




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

Measured memory_bytes: 22868
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <math.h>
#include <map>
using namespace std;
#define REP(i, k, n) for(int i = k;i < n; i++)
#define rep(i, n) REP(i,0,n)
#define ll long long int
int dx[4] = {0,-1,1,0};
int dy[4] = {-1,0,0,1};
#define eps 10e-6
#define mod 1000000007
ll arr[100001];
int main(void){
	ll n,k;
	cin >> n >> k;
	rep(i,n){
		int a,b;
		cin >> a >> b;
		arr[a] += b;
	}
	ll cnt = 0;
	rep(i,100001){
		cnt += arr[i];
		if(cnt >= k){
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <math.h>
#define N 101
#define INFTY 200000000
using namespace std;
void prim();
int n,p[N];
double M[N][N],d[N],x[N],y[N],z[N],r[N];
string color[N];
int main(){
  int i,j;
  double min,xc,yc,zc;
  while(1){
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++) cin >> x[i] >> y[i] >> z[i] >> r[i];
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	M[i][j]=-1;
      }
    }
    for(i=0;i<n-1;i++){
      for(j=i+1;j<n;j++){
	xc=x[i]-x[j];
	yc=y[i]-y[j];
	zc=z[i]-z[j];
	if(xc<0) xc*=-1;
	if(yc<0) yc*=-1;
	if(zc<0) zc*=-1;
	M[i][j]=M[j][i]=sqrt(xc*xc+yc*yc+zc*zc)-r[i]-r[j];
	if(M[i][j]<0) M[i][j]=M[j][i]=0;
      }
    }
    prim();
    min=0.0;
    for(i=0;i<n;i++){
      if(d[i]!=INFTY) min+=d[i];
      else{
	min=0;
	break;
      }
    }
    printf("%.3f",min);
    cout << endl;
  }
  return 0;
}
void prim(){
  int i,j,u;
  double mincost;
  for(i=0;i<n;i++) color[i]="WHITE",d[i]=INFTY;
  d[0]=0;
  p[0]=-1;
  while(1){
    mincost=INFTY;
    for(i=0;i<n;i++){
      if(color[i]!="BLACK"&&d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==INFTY) break;
    color[u]="BLACK";
    for(i=0;i<n;i++){
      if(color[i]!="BLACK"&&M[u][i]!=-1){
	if(M[u][i]<d[i]){
	  d[i]=M[u][i];
	  p[i]=u;
	  color[i]="GLAY";
	}
      }
    }
  }
}

Measured memory_bytes: 1372
N=int(input())
a=list(map(int,input().split()))
a=[bin(a[i])[2:].zfill(20) for i in range(N)]
ans=0
x=[-1]*20
tmp=-1
for i in range(N):
    for j in range(20):
        if a[i][j]=="1":
            tmp=max(tmp,x[j])
            x[j]=i
    ans+=i-tmp

print(ans)

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

int A[40], n;

int solve(int i, int m){
	int res;
	if(m == 0) return true;
	if(i > n)  return false;
	
	res = solve(i+1, m) || solve(i+1,m-A[i]);
	return res;
}

int main(){
	int ans, q, m;
	
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>A[i];
	}
	
	cin>>q;
	
	for(int i = 0; i < q; i++){
		cin>>m;
		if(solve(0, m)) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3096
#include<iostream>
int main()
{
	long long n,a=2,b=1,c;
	std::cin >> n;
	if (n == 1) {
		std::cout << "1" << std::endl;
	}
	else {
		for (int i = 2; i <= n; i++) {
			c = a;
			a = b;
			b +=c;
		}
		std::cout << b << std::endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <iomanip>
#define INFTY 30000
using namespace std;

int main(void){
    string s; 
    int temp = 0;
    int out = 0;
    cin >> s;
    for (int i = 0 ; i < 11; i++){
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') {temp++ ;}
        else{
                if(temp > out) out = temp;
                temp = 0;
        } 
    }
    cout << out << endl;
}

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

int main() {
    int a[3][3] = {};
    rep(i,3) {
        rep(j,3) {
            cin >> a[i][j];
        }
    }
    int n, b;
    cin >> n;
    rep(i, n) {
        cin >> b;
        rep(j,3) {
            rep(k,3){
                if (a[j][k] == b) {
                    a[j][k] = -1;
                }
            }
        }
    }

    bool flag = false;
    rep(i,3) {
        flag |= a[i][0] == a[i][1] && a[i][1] == a[i][2];
        flag |= a[0][i] == a[1][i] && a[1][i] == a[2][i];
    }
    flag |= a[0][0] == a[1][1] && a[1][1] == a[2][2];
    flag |= a[2][0] == a[1][1] && a[1][1] == a[0][2];
    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

const int N=3010;
int f[N][N][2];

void Add(int &x,const int &y){x=(x+y>=ha)?(x+y-ha):(x+y);}

int main()
{
//
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) f[1][i][0]=1;
    f[1][0][1]=1;
    for(int i=1;i<=m;i++)
        for(int j=0;j<=n;j++)
        {
            if(j>=1)
            {
                Add(f[i+1][j-1][1],f[i][j][1]);
                if(j==1) Add(f[i+1][j-1][1],f[i][j][0]);
                else Add(f[i+1][j-1][0],f[i][j][0]);
            }
            if(j<n)
            {
                Add(f[i+1][j+1][1],f[i][j][1]);
                Add(f[i+1][j+1][0],f[i][j][0]);
            }
            if(j>=1)
            {
                Add(f[i+1][j][1],f[i][j][1]);
                if(j==1) Add(f[i+1][j][1],f[i][j][0]);
                else Add(f[i+1][j][0],f[i][j][0]);
            }
            if(j<n)
            {
                Add(f[i+1][j][1],f[i][j][1]);
                Add(f[i+1][j][0],f[i][j][0]);
            }
        }
    int ans=0;
    for(int i=0;i<=n;i++) Add(ans,f[m+1][i][1]);
    printf("%d\n",ans);
    return 0;
}

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

int n, i, j, x;
int main() {
	cin >> n >> x;
	bool flag = false;
	for (int i = 0; i <= n; i++) {
		for (j = 0; j + i <= n; j++) {
			if ((i) * 10000 + j * 5000 + (n - i - j) * 1000 == x) {
				cout << i << ' ' << j << ' ' << n - (i + j) << endl;
				flag = true;
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	if (flag == false) {
		cout << "-1 -1 -1" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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



int main() {
    ll n, m;
    scanf("%lld %lld", &n, &m);
    vector<ll> a(n);
    REP(i, n){
        scanf("%lld", &a[i]);
    }
    map<ll, ll> mp;
    mp[0]++;
    mp[a[0] % m]++;
    for(int i = 1; i < n; i++){
        a[i] += a[i - 1];
        mp[a[i] % m]++;
    }
    ll ans = 0;
    for(auto x : mp){
        ans += x.second * (x.second - 1) / 2;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 4992
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;



int main() {
	string S;
	cin >> S;
	if (S.size() % 2 == 1) {
		cout << "No" << endl;
	}
	else {
		for (int i = 0; i < S.size(); i += 2) {
			if (S.substr(i, 2) != "hi") {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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;}

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint n;
	cin>>n;
	lint ans=0;
	vector<lint>p;
	for(lint i=2;i*i<=n;++i){
		lint num=0;
		while(n%i==0){
			n/=i;
			num++;
		}
		if(num!=0)p.push_back(num);
	}
	if(n!=1)p.push_back(1);
	lint sz=SZ(p);
	rep(i,sz){
		lint j=1;
		while(0<=p[i]-j){
			p[i]-=j;
			j++;
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3656
#!py2
"""
Build answer bit by bit.  For kth bit, let T = 2^k, and consider a, b mod 2T.
Want T <= a+b < 2T or 3T <= a+b
Can use two pointers to find these
"""

def solve(N, A, B):
    ans = 0
    for bit in range(29):
        T = 1 << bit
        A2 = sorted((x % (2*T) for x in A), reverse = True)
        B2 = sorted(x % (2*T) for x in B)
        i1 = i2 = i3 = 0
        # T <= x + b < 2T
        # 3T <= x + b
        # i_k is first with B2[i_k] + x >= T*k
        
        ending = 0
        for x in A2:
            while i1 < len(B2) and B2[i1] + x < T:
                i1 += 1
            while i2 < len(B2) and B2[i2] + x < 2*T:
                i2 += 1
            while i3 < len(B2) and B2[i3] + x < 3*T:
                i3 += 1
            ending ^= (len(B2) - i3 + i2 - i1) % 2
        ans += ending << bit
    return ans

N = int(raw_input())
A = map(int, raw_input().split())
B = map(int, raw_input().split())
print solve(N, A, B)

Measured memory_bytes: 149272
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
//main
signed main(){
  int N;cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  //座圧
  map<int,int> m;
  for(int i=0;i<N;i++)m[v[i]]=0;
  int cnt=0;
  for(auto &p:m)p.second=cnt++;
  for(int i=0;i<N;i++)v[i]=m[v[i]];
  //座圧
  int s=0,t=0;
  for(int i=0;i<N;i++){
    if((i&1)&&((v[i]&1)==0))s++;
    if(((i&1)==0)&&(v[i]&1))t++;
  }
  cout<<max(s,t)<<endl;
}


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

int main() {
    
    int a,b,c;
    cin>>a>>b>>c;
    
    int s=0;
    
    if(a==b && a != c)s=1;
    if(a==c && a != b)s=1;
    if(b==c && b != a)s=1;
    
    if(s==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256