akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#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>
#if __cplusplus >= 201103L
#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>
#endif
using namespace std;

int main() {

	int N;
	cin >> N;
	cout << N * (N + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    rep(i,s.size()){
        if(s[i]!=s[s.size()-1-i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    rep(i,s.size()/2){
        if(s[i]!=s[s.size()/2-i-1]){
            cout<<"No"<<endl;
            return 0;
        }else if(s[i+s.size()/2+1]!=s[s.size()-1-i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n,k;
    cin >> n >> k;
    cout << n-k+1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];
		int abs = 0;
		int num = 1;
		for(int i = 1; i < n + 1; i++) {
			int in = sc.nextInt();
			a[i] = in;
			if(Math.abs(abs) < Math.abs(in)) {
				abs = in;
				num = i;
			}
		}
		int cnt = 0;
		String ans = "";
		for(int i = 1; i < n + 1; i++) {
			if(i != num) {
				ans += num + " " + i + "\n";
				cnt++;
			}
		}
		if(abs < 0) {
			for(int i = n; i > 1; i--) {
				ans += i + " " + (i - 1) + "\n";
				cnt++;
			}
		} else {
			for(int i = 1; i < n; i++) {
				ans += i + " " + (i + 1) + "\n";
				cnt++;
			}
		}
		ans = cnt + "\n" + ans;
		System.out.println(ans);

	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define pi 3.141592653589793238462643383279502884197
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
int fi[109][109];
signed main(){
	int h,w;
	cin>>h>>w;
	int n;
	cin>>n;
	int cur = 0;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		for(int j=1;j<=a;j++){
			int r = cur/w;
			int c = cur%w;
			if( r % 2 == 1 ) c = w - 1 - c;
			fi[r][c] = i;
			cur++;
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<fi[i][j];
			if( j!=w-1 ) cout << " ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Integer A = input.nextInt();
        Integer B = input.nextInt();
        Integer C = input.nextInt();
        Integer D = input.nextInt();

        Integer ConfirmTimeT = (int)Math.ceil((float)C / B);
        Integer ConfirmTimeA = (int)Math.ceil((float)A / D);

        if (ConfirmTimeT <= ConfirmTimeA) System.out.println("Yes");
        else System.out.println("No");
    }
}


Measured memory_bytes: 35780
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [b] <- getLine
  putChar $ solve b

solve b
  | b == 'A' = 'T'
  | b == 'T' = 'A'
  | b == 'G' = 'C'
  | b == 'C' = 'G'

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

Measured memory_bytes: 380
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <typename Abelian>
struct BIT0based {
  BIT0based(int n, const Abelian UNITY = 0) : n(n), UNITY(UNITY), dat(n, UNITY) {}

  void add(int idx, Abelian val) {
    while (idx < n) {
      dat[idx] += val;
      idx |= idx + 1;
    }
  }

  Abelian sum(int idx) {
    Abelian res = UNITY;
    --idx;
    while (idx >= 0) {
      res += dat[idx];
      idx = (idx & (idx + 1)) - 1;
    }
    return res;
  }

  Abelian sum(int left, int right) {
    if (right <= left) return UNITY;
    return sum(right) - sum(left);
  }

  Abelian operator[](const int idx) { return sum(idx, idx + 1); }

  int lower_bound(Abelian val) {
    if (val <= UNITY) return 0;
    int res = 0, exponent = 1;
    while (exponent <= n) exponent <<= 1;
    for (int mask = exponent >> 1; mask > 0; mask >>= 1) {
      if (res + mask - 1 < n && dat[res + mask - 1] < val) {
        val -= dat[res + mask - 1];
        res += mask;
      }
    }
    return res;
  }

private:
  int n;
  const Abelian UNITY;
  vector<Abelian> dat;
};

int main() {
  int n, q; string s; cin >> n >> s >> q;
  vector<BIT0based<int> > bit(26, n);
  REP(i, n) bit[s[i] - 'a'].add(i, 1);
  while (q--) {
    int query; cin >> query;
    if (query == 1) {
      int i; char c; cin >> i >> c; --i;
      bit[s[i] - 'a'].add(i, -1);
      s[i] = c;
      bit[c - 'a'].add(i, 1);
    } else if (query == 2) {
      int l, r; cin >> l >> r; --l; --r;
      int ans = 0;
      REP(i, 26) ans += bit[i].sum(l, r + 1) > 0;
      cout << ans << '\n';
    }
  }
  return 0;
}


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

int main(){
  int64_t L, R;
  cin >> L >> R;

  if (R - L > 2019){
    cout << 0 << endl;
    return 0;
  }

  L %= 2019; R%= 2019;
  if(L < R){
    int ans = 99999;
    for(int i=L; i<=R; i++){
      for(int j=i+1; j<=R; j++){
        ans = min(ans, i*j%2019);
      }
    }
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt();
			System.out.println((n * 100 + m * 1800) * (1 << m));
		}
	}
}


Measured memory_bytes: 35688
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int n, m, wat[100004];
bool aced[100004];

int main(void) {
	ios::sync_with_stdio(false);
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		int pid;
		char si[8];
		cin >> pid >> si;
		if (si[0] == 'A') {
			//cout << "  " << pid << "  acc" << endl;
			aced[pid] = true;
		} else {
			if (!aced[pid]) {
				wat[pid]++;
			}
		}
	}

	int acn = 0, pen = 0;
	for (int i = 1; i <= n; i++) {
		if (aced[i]) {
			//cout << "  acid" << i << "  " << wat[i] << endl;
			acn++;
			pen += wat[i];
		}
	}

	cout << acn << ' ' << pen << endl;
	return 0;
}

Measured memory_bytes: 768
import math
d, g = [int(item) for item in input().split()]
pc = [[int(item) for item in input().split()] for _ in range(d)]

ans = 10**5
for i in range(2**d):
    count = 0
    score = 0
    for j in range(d):
        if i >> j & 1:
            count += pc[j][0]
            score += pc[j][1] + pc[j][0] * (j+1) * 100
    if score >= g:
        ans = min(ans, count)
        continue
    lest_i = d-1 
    while i >> lest_i & 1:
        lest_i -= 1

    lest_num = math.ceil((g - score) / ((lest_i + 1) * 100))
    if lest_num < pc[lest_i][0]:
        count += lest_num
        ans = min(ans, count)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(count);
	}
}

Measured memory_bytes: 21844
n, m = map(int, input().split())

MOD = 10**9+7

dp = [0]*(n+1)
dp[0] = 1
broken = [0]*(n+1)
for i in range(m):
    broken[int(input())] = 1
    
for i in range(1, n+1):
    if broken[i] == 1:
        continue
    else:
        if i != 1:
            dp[i] = dp[i-1] + dp[i-2]
        elif i == 1:
            dp[i] = dp[i-1]

print(dp[-1]%MOD)

Measured memory_bytes: 460788
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int D;
	cin >> D;
	cout << "Christmas";
	for (int i = 0; i < 25 - D; i++) {
		cout << " Eve";
	}
}

Measured memory_bytes: 256
import bisect

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()

ans = 0
for x in b:
    ans += (bisect.bisect_left(a, x)) * (n - bisect.bisect_right(c, x))

print(ans)

Measured memory_bytes: 29700
import sys
input = sys.stdin.readline

N = int(input())
L = [input().strip().split() for _ in range(N)]

s = 0
for v in L:
    if v[1] == "JPY":
        s += int(v[0])
    else:
        s += float(v[0]) * 380000
        
print(s)

Measured memory_bytes: 3064
import collections
n=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
firstnum=0
secondnum=0
firstl=0
secondl=0
values,counts=zip(*a.most_common())
for i,j in a.items():
  if i>=firstl and j>=2:
    secondnum=firstnum
    firstnum=j
    secondl=firstl
    firstl=i
  elif secondl<=i<firstl and j>=2:
    secondnum=j
    secondl=i
if firstnum>=4:
  print(firstl**2)
else:
  print(firstl*secondl)

Measured memory_bytes: 28556
n,m = map(int,input().split())
lst1 = [list(map(int,input().split())) for i in range(m)]

lst2 = [0]*n

for i,j in lst1:
    lst2[i-1] += 1
    lst2[j-1] += 1

for i in lst2:
    print(i) 

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 1000009
ll m=0; int n=0; int ans=0;
bool flag;
/*void dfs(int num){
 if(flag) return;
 if(ans==num){flag=true;return;}
 if(num>ans){memo[num]=false;return;}
 else rep(i,n){
 cout<<num<<endl;
 if(num+v[i]<=ans&&memo[num+v[i]])dfs(num+v[i]);
 }
 memo[num]=false;
 return;
 }*/
int main(){
    vector<bool>check(MAX+1);  //index number will be checked
    rep(i, MAX+1)check[i] = true;
    vector<int>Primenumber(MAX+1,0); //Primearray
    int counter =0;                  //Primearray counter;
    for(int i = 2; i<MAX+1;i++){
        if(check[i]){
            for(int j = 2;i*j<MAX;j++)
                check[i*j] = false;//??´????°??????Primearray????????´???????????????????°??????¨???false???
            Primenumber[counter] = i;
            counter++;
        }
    }
    while(cin>>n>>m,n+m){
        vi v;
        vi hoge;
        int temp;
        flag=false;
        int ans=0;
        rep(i,n){cin>>temp; v.push_back(temp);}
        for(int i=(int)m;i>=0;i--){
            if(check[i]){
                hoge.push_back(i);
            }
        }
        sort(hoge.begin(), hoge.end(), greater<int>());
        bool array[MAX]; rep(i,MAX)array[i]=false;
        rep(i,n)array[v[i]]=true;
        for(int i=1;i<=m;i++) {
            if(array[i])rep(j,n)if(i+v[j]<=m)array[i+v[j]]=true;
        }
        rep(i,hoge.size()){
            
            if(array[hoge[i]]){
                ans=hoge[i]; flag=true; break;
            }
        }
        if(flag) cout<<ans<<endl;
        else cout<<"NA"<<endl;
    }
}

Measured memory_bytes: 8488
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;
int main(){
	string a;
	cin>>a;
	if(a=="SAT"){
		cout<<1;
	return 0;
	}
	else if(a=="FRI"){
		cout<<2;
	}
	else if(a=="THU"){
		cout<<3;
	}
	else if(a=="WED"){
		cout<<4;
	}
	else if(a=="TUE"){
		cout<<5;
	}
	else if(a=="MON"){
		cout<<"6";
	}
	else if(a=="SUN"){
		cout<<7;
	}
}


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

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

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

ll gcd(ll a, ll b)
{
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int main()
{   
    ll N, M;
    cin >> N >> M;
    string S, T;
    cin >> S >> T;
    ll G = gcd(N, M);
    ll n = N / G, m = M / G;
    
    bool f = true;
    REP(i,0,G) {
        if(S[n*i] != T[m*i]) {
            f = false;
            break;
        }
    }

    if(f) PR(G*n*m);
    else PR(-1);
    
    return 0;
}

/*



*/

Measured memory_bytes: 3664
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){
    int n, k; cin >> n >> k;
    int sum = 0;
    rep(i, n){
        int a; cin >> a;
        sum += min(a, k-a)*2;
    }
    cout << sum << ln;
}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);


  int n,k;cin>>n>>k;
  string s;cin>>s;

  queue<pair<int, char> > q;
  int st=0, res=0, flip=0;
  for(int i=0;i<n;i++){
    if(s[i]=='0')flip++;
    int t=0;
    char c=s[i];
    for(int j=i;j<n;j++){
      if(c==s[j]){t++;if(j==n-1)i=j;}
      else {i=j-1; break;}
    }
    // cout<<i<<':'<<t<<endl;
    q.push({t,s[i]});
    st+=t;
    if(flip>k){
      flip--;
      auto q1 = q.front();q.pop();
      st-=q1.first;
      if(q1.second=='1'){
        auto q2 = q.front();q.pop();
        st-=q2.first;
      }
    }
    res=max(res,st);
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 848
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				push_back(z)
#define ff					/first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
//#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}

void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}

void solve()
{
 	 ll n;cin>>n;
 	 ll a[n+3],b[n+2];
 	 rep0(i,n)cin>>a[i];
 	 rep0(i,n){
 	 	ll inp;cin>>inp;
 	 	b[i]=a[i]-inp;
	  }
	  ll cnt=0;
	  rep0(i,n){
	  	if(b[i]>-1)cnt+=b[i];
	  }
	  cout << cnt << nl;
}

int main() {
	fast_io
	//start();
    //caset{
    	//cout << "Case " << tt << ": ";

		  solve();
	//}
	
	return 0;
}


Measured memory_bytes: 3612
N = int(input())
S = list(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
 
ans = r*g*b
for i in range(N-2):
  for j in range(i+1, N-1):
    k = 2*j-i
    if k <= N-1:
      if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
        ans -= 1
 
print(ans)

Measured memory_bytes: 68184
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val ACGT = Array('A', 'C', 'G', 'T')
  val S = sc.next
  var result = 0
  var l = 0
  for (b <- S) {
    if (ACGT contains b) {
      l += 1
    } else {
      if (result < l) {
        result = l
      }
      l = 0
    }
  }
  if (result < l) {
    result = l
  }
  println(result)
}

Measured memory_bytes: 26932
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

  cout << ans << endl;
}


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

using namespace std;

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

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

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

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  REP(i, n-2){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
      ++ans;
    }
  }
  cout<<ans<<'\n';
  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 r;
    cin >> r;
    cout << r * r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define dF3(i,a,b) for(int i=(a)-1;i>=(b);--i)
using namespace std;typedef long long ll;typedef double ld;int INF=0x3f3f3f3f;int INF2=0x7fffffff;ll LNF=0x3f3f3f3f3f3f3f3f;ll LNF2=0x7fffffffffffffff;

int n,m,y;
ll k;
ll x[100001],a[100001];
ll s[100001],ans[100001],tmp[100001];

int main(){
	scanf("%d",&n);
	F(i,1,n) scanf("%lld",x+i), s[i]=i, ans[i]=i;
	dF(i,n,1) x[i]-=x[i-1];
	scanf("%d%lld",&m,&k);
	F(i,1,m) scanf("%d",&y), swap(s[y],s[y+1]);
	while(k){
		if(k&1)
			F(i,1,n) ans[i]=s[ans[i]];
		F(i,1,n) tmp[i]=s[s[i]];
		F(i,1,n) s[i]=tmp[i];
		k>>=1;
	}
	F(i,1,n) tmp[i]=x[ans[i]];
	F(i,1,n) x[i]=tmp[i];
	F(i,1,n) x[i]+=x[i-1];
	F(i,1,n) printf("%lld.0\n",x[i]);
	return 0;
}

Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007


int32_t main(){
IOS;
int h,n;
cin>>h>>n;
int sum = 0;
for(int i=0;i<n;i++)
{int x;
cin>>x;
    sum += x;
}
if(sum >= h)
cout<<"Yes"<<endl;
else
{
    cout<<"No"<<endl;
}
     
return 0;
}


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

int main(){
ios_base::sync_with_stdio(0); cin.tie(0); 
string s;
cin >> s;
int fi, se;
int t = s.size();
for(int i{}; i<s.size(); i++){
	if(s[i] == 'A'){
		fi = i;
		break;
	}

}


for(t; t>0; t--){
	if(s[t] == 'Z'){
		se = t;
		break;
	}
}


	cout << se-fi+1 << "\n";
}





Measured memory_bytes: 720
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define FF first
#define SS second
#define pii pair<int,int>
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(x) (int)x.size()
#define mp make_pair
#define Mod 1000000007
typedef long long int ll;
void debuging(int i){
	cout<<"AAAAAAA"+to_string(i)<<"\n";
}
// g++ -DLOCAL -std=c++17 -Wshadow -Wall  "codeforces.c++" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g

// dp[i][j] -> cost of merging cells between i and j

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// #endif

	int n, i, l, r;
	cin >> n;
	vector<ll> a(n);	
	for(ll &x : a)
		cin >> x;
	vector<ll> prefix(n);
	vector<vector<ll>> dp(n, vector<ll>(n));

	for(l = 0; l < n; l++)
		prefix[l] = (l > 0 ? prefix[l-1]:0) + a[l];

	for(l = n-1; l >= 0; l--)
		for(r = l; r < n; r++)
			if(l != r){
				dp[l][r] = 1e18;
				for(int  k = l; k < r; k++)
					dp[l][r] = min(dp[l][r], dp[l][k] + dp[k+1][r]);
				dp[l][r] += prefix[r]  - (l > 0 ? prefix[l-1]:0);
			}

	cout<<dp[0][n-1];
}	


Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int main() {
	int N;
	cin >> N;
	vector<string>S(N);
	for (int i = 0; i < N; i++)cin >> S[i];
	
	int ans = 0;
	for (int b = 0; b < N; b++) {
		int cnt = 0;
		vector<vector<char>>temp(N,vector<char>(N));
		for (int i = 0; i < N; i++)for (int j = 0; j < N; j++)temp[i][j] = S[i][(j+b)%N];
		for (int i = 0; i < N; i++)for (int j = 0; j < N; j++)if (temp[i][j] == temp[j][i])cnt++;
		if (cnt == N * N)ans += N;
	}
	puts(ans);

	return 0;
}

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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n; cin >> n;
	long double ans = 0;
	int a;
	while (n--)
	{
		cin >> a;
		ans += 1.0 / a;
	}
	ans = 1.0 / ans;
	cout << setprecision(16) << ans << endl;
	return 0;
}

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

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

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

using namespace std;

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

typedef long long ll;
typedef long double ld;

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

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

  if (n == 3) {
    printf("2 5 63\n");
    return 0;
  }

  vector<int> val;
  val.push_back(2);
  val.push_back(5);
  val.push_back(63);
  for (int i = 70; i <= 30000; i++) {
    if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
      val.push_back(i);
    }
  }

  vector<int> any(30, -1);
  for (int i : val) {
    if (i > 70 && any[i % 30] == -1) {
      eprintf("%d %d\n", i % 30, i);
      any[i % 30] = i;
    }
  }

  while (true) {
    random_shuffle(val.begin() + 3,  val.end());
    int res = 0;
    vector<int> ans;
    for (int i : val) {
      if (find(any.begin(), any.end(), i) == any.end()) {
        ans.push_back(i);
        res = (res + i) % 30;
      }
      if ((int)ans.size() == n - 1) break;
    }
    assert((int)ans.size() == n - 1);
    int rem = (30 - res) % 30;
    if (any[rem] != -1) {
      ans.push_back(any[rem]);
      for (int i : ans) {
        printf("%d ", i);
      }
      printf("\n");
      break;
    }
  }

  return 0;
}


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

int main(){
  int K;
  cin >> K;
  long long a = 7;
  int ans = -1;
  for(int i=1; i<=K; i++){
    if(a%K==0){
      ans = i;
      break;
    }
    a = 10*a+7;
    a %= K;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	const int ms = 3030;
	std::vector<int> freq(ms, 0);
	std::vector<int> a(n);
	for(auto &x : a) std::cin >> x;
	std::sort(a.begin(), a.end());
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = a[i]+1; j < ms; j++) {
			ans += freq[j];
		}
		//std::cout << a[i] << ", " << ans << '\n';
		for(int j = 0; j < i; j++) {
			freq[std::min(ms-1, a[i] + a[j])]++;
		}
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
int main(){
    int n,i;
    cin>>n;
    if(n==0){cout<<0<<endl;return 0;}
    vector<string>song(n);
    vector<int>l(n);
    for(i=0;i<n;i++){
        cin>>song[i]>>l[i];
    }
    string x;
    cin>>x;
    for(i=0;i<n;i++){
        if(song[i]==x)break;
    }
    cout<<accumulate(l.begin()+i+1,l.end(),0)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            String line;
            int i = 1;
            while((line = br.readLine()) != null){
                if(line.equals("0")){
                	break;
                }
                System.out.println("Case " + i + ": " + line);
                i++;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

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

int main(){
	long long int N; 
	cin >> N;
	int K=1;
	for(int i=0;i<20;i++){
		if(N >= K){
		K=2*K;
		}
	}
	int a = N-(K/2);
	if(a == 0){
		cout << "No" << endl;
	}else if(a%2 == 1){
			cout << "Yes" << endl;
			cout << 1 << " " << 2 <<endl;
			cout << 2 << " " << 3 <<endl;
			cout << 3 << " " << N+1 <<endl;
			cout << 1 << " " << N+3 <<endl;
			cout << N+2 << " " << N+3 <<endl;
		if(N > 3){
			for(int j=4;j<=N;j=j+2){
			cout << 1 << " " << j <<endl;
			cout << j << " " << j+1 <<endl;
			cout << 1 << " " << N+j+1 <<endl;
			cout << N+j+1 << " " << N+j <<endl;
			}
		}
	}else if(a%2 == 0){
			cout << "Yes" << endl;
			cout << 1 << " " << 2 <<endl;
			cout << 2 << " " << 3 <<endl;
			cout << 3 << " " << N+1 <<endl;
			cout << 1 << " " << N+3 <<endl;
			cout << N+2 << " " << N+3 <<endl;
		if(N > 3){
			for(int j=4;j<N;j=j+2){
			cout << 1 << " " << j <<endl;
			cout << j << " " << j+1 <<endl;
			cout << 1 << " " << N+j+1 <<endl;
			cout << N+j+1 << " " << N+j <<endl;
			}
			cout << (K/2) << " " << N <<endl;
       		cout << 2*N << " " << N+a+1 <<endl;
		}
	}
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  string s;cin >> s;
  int n=s.size();
  rep(i,n/2){
    if(s[i]!=s[n/2+1+i]){cout << "No";return 0;}
  }

  rep(i,n/4){
    if(s[i]!=s[n/2-1-i]){cout << "No";return 0;}
  }
  
  cout << "Yes";
}

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

int main() {
  int n, ans = 0;
  char s[110];
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - 1 - i]) {
      ans++;
    }
  }
  printf("%d\n", ans);
}

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

int const MAXN = 2e5;
int c[MAXN];
std::vector<int> G[MAXN];
int N;
int64_t ans[MAXN];
int nn[MAXN], csum[MAXN];

void dfs(int v, int p) {
  int cv = c[v], save = csum[cv], nodes = 1;
  for(auto ch: G[v]) if(ch != p) {
    int pcsum = csum[cv];
    dfs(ch, v);
    int dcsum = csum[cv] - pcsum;
    int w = nn[ch] - dcsum;
    ans[cv] -= (int64_t)w*(w+1)/2;
    nodes += nn[ch];
  }
  csum[cv] = save + (nn[v] = nodes);
}

int main() {
  std::cin >> N;
  for(int i = 0; i < N; ++i) { std::cin >> c[i]; --c[i]; }
  for(int i = 0; i < N-1; ++i) {
    int a, b; std::cin >> a >> b; --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  std::fill_n(ans, N, (int64_t)N*(N+1)/2);
  dfs(0, -1);
  for(int i = 0; i < N; ++i) {
    int w = N - csum[i];
    ans[i] -= (int64_t)w*(w+1)/2;
  }
  for(int i = 0; i < N; ++i) std::cout << ans[i] << std::endl;
  return 0;
}


Measured memory_bytes: 40280
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main(){
	string A;
	int count = 0;
	int bj;

	while(cin >> A){
		string B="";

		for(int j=0;A[j] !='\0';j++){bj = j;}

		for(int i=bj;i >= 0;i--){
			B += A[i];
		}

		if(A == B)count++;

	}

	cout << count << endl;
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t K, N;
  cin >> K >> N;
  vector<int64_t> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  vec.push_back(vec.at(0) + K);
  int64_t ans = 0;
  int64_t MAX = 0;
  for(int i=0; i<N; i++){
    ans += vec.at(i+1) - vec.at(i);
    MAX = max(MAX,vec.at(i+1) - vec.at(i));
  }
  cout << ans - MAX << endl;
}

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

int dSum(int num){
	int sum = 0;
	while(num){
    		sum += num%10;
    		num /= 10;
	}

	return sum;
}

int main(){
	int n;
	cin>>n;
	int minsum = 999999999;
	int a = 1, b = n-1;
	int fsum = 0;
	while(a <= b){
		fsum = dSum(a) + dSum(b);
		if(fsum < minsum) minsum = fsum;
		a++; b--;
	}
	cout<<minsum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define deb(x) cout<<#x<<" = "<<x<<"\n";
using namespace std;
 
signed main()
{
//	freopen("input.txt", "r", stdin);
	
	int n; cin>>n;
	
	map<string, int> m;
	
	while(n--)
	{
		string s; cin>>s;
		sort(s.begin(), s.end());
		m[s]++;
	}
	int ans = 0;
	for(auto it : m)
	{
		int x = it.second;
		ans += (x * (x-1) / 2);
	}
	cout<<ans<<"\n";
	
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

typedef pair<int,int> pi;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

const int maxn = 55;

char G[maxn][maxn];
int D[maxn][maxn];
int H,W;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};

bool valid(int x,int y){
    if(x >= 0 && x < H && y>=0 && y < W && G[x][y]=='.' && D[x][y] == -1) return true;
    return false;
}

int main()
{
    scanf("%d %d",&H,&W);
    getchar();
    _for(i,0,H){
        fgets(G[i],55,stdin);
    }
    int white = 0;
    _for(i,0,H){
        _for(j,0,W){
            if(G[i][j] == '.') white++;
        }
    }
    if(G[0][0] == '#'){printf("-1");return 0;}
    memset(D,-1,sizeof(D));
    D[0][0] = 1;
    pi st = make_pair(0,0);
    queue<pi> que;
    que.push(st);
    while(!que.empty()){
        pi pp = que.front();
        que.pop();
        int x = pp.first;
        int y = pp.second;
        _for(i,0,4){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(valid(nx,ny)){
                D[nx][ny] = D[x][y] + 1;
                que.push(make_pair(nx,ny));
            }
        }
    }

    if(D[H-1][W-1] == -1)printf("-1");
    else printf("%d\n",white-D[H-1][W-1]);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";

#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);

int main(){
	int x, y;
	cin >> x >> y;
	for(int i = 0; i <= x; i++){
		if(i * 2 + (x - i) * 4 == y){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
} 

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

int main(){
  string s,g;
  int k=0;
  while(cin>>s){
    g=s;
    reverse(s.begin() , s.end() );
    if(g==s)k++;
  }
  cout<<k<<endl;
  return 0;
}

Measured memory_bytes: 2984
#include <iostream>


int main()
{
    int sNum;
    std::cin >> sNum;

    int *sArray = new int[sNum];
    for (int i = 0; i < sNum; i++) std::cin >> sArray[i];

    int tNum;
    std::cin >> tNum;

    int *tArray = new int[tNum];
    for (int i = 0; i < tNum; i++) std::cin >> tArray[i];

    int containNum = 0;
    for (int t = 0; t < tNum; t++)
    {
        for (int s = 0; s < sNum; s++)
        {
            if (tArray[t] == sArray[s])
            {
                containNum++;
                break;
            }
        }
    }

    std::cout << containNum << std::endl;
}



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

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int main()
{
    //fastio
    ll n,x,t;
    sfffl(n,x,t);
    ll cnt = ceil(n/(x+0.0));
    cout<<cnt*t<<endl;

    return 0;
}

Measured memory_bytes: 3804
#!/usr/bin/env python
def guide():
    n = int(raw_input())
    d = {}
    j = []
    for _ in range(n):
        a, b = raw_input().split(' ')
        j.append(int(b))
        d[int(b)] = a

    c = {}
    f = []
    for a in d:
        e = d[a]
        f.append(e)
        if c.has_key(e):
            c[e].append(a)
        else:
            c[e] = []
            c[e].append(a)

    f = list(set(f))
    f.sort()
    h = []
    for g in f:
        c[g].sort(reverse=True)
        h += c[g]

    for k in h:
        print(j.index(k)+1)

guide()


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr <<"\e[91m"<<__func__<<": "<< #x << " = " << x <<"\e[39m"<< "\n"
typedef pair<int, int> pii;
typedef long long ll;
const double eps = 1e-9;
const int inf = 0x3f3f3f3f;


int main()
{
#ifndef ONLINE_JUDGE
    freopen("../io/in.txt", "r", stdin);
    //freopen("../io/out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    int n;
    cin >> n;
    if(n < 1000) n = 1000 - n;
    else {
        while(n >= 1000) n -= 1000;
        if(n > 0) n = 1000 - n;
    }
    cout << n << "\n";
    return 0;
}


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

int n;
int binarySearch(vector<int> A, int key){
    int left = 0;
    int right = n;
    while(left < right){
        int mid = (left + right)/2;
        if (A[mid] == key) return 1;
        else if (A[mid] < key) left = mid + 1;
        else if (A[mid] > key) right = mid;
    }
    return 0;
}

int main(){
    cin >> n;
    vector<int> S(n);
    for (int i = 0; i < n; i++) cin >> S[i];
    int q;
    cin >> q;
    vector<int> T(q);
    for (int i = 0; i < q; i++) cin >> T[i];
    int sum = 0;
    for (int i = 0; i < q; i++) {
        if (binarySearch(S,T[i])) sum++;
    }
    cout << sum << endl;
}


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

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

    if(k>a+b)   cout<<0<<' '<<0<<endl;
    else if(a>k) cout<<a-k<<' '<<b<<endl;
    else    cout<<0<<' '<<b-(k-a)<<endl;
    
 return 0;
}

Measured memory_bytes: 256
n, m, x = map(int, input().split())
a_list = []
c_list = []
for i in range(n):
    a = [int(i) for i in input().split()]
    a_list.append(a[1:])
    c_list.append(a[0])
ans = -1
for j in range(2 ** n):
    ans_list = [0] * m
    cost = 0
    for i in range(n):
        if j & (2 ** i) > 0:
            for index, k in enumerate(a_list[i]):
                ans_list[index] += k
            cost += c_list[i]
    if sum([1 for i in ans_list if i >= x]) == m:
        if ans == -1:
            ans = cost
        else:
            ans = min(ans, cost)
print(ans)

Measured memory_bytes: 9224
#include <cstdio>
#include <vector>

using namespace std;

int a[3000];
vector <int> v[3000];

int dfs(int x, int y) {
	int i;
	
	for (i = 0; i < v[x].size(); i++) {
		if (v[x][i] == y) continue;
		
		if (a[x] <= a[v[x][i]]) continue;
		
		if (dfs(v[x][i], x) == -1) return 1;
	}
	
	return -1;
}

int main() {
	int n, i;
	vector <int> ans;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) scanf("%d", &a[i]);
	
	for (i = 0; i < n - 1; i++) {
		int x, y;
		
		scanf("%d %d", &x, &y);
		
		x--;
		y--;
		
		v[x].push_back(y);
		v[y].push_back(x);
	}
	
	for (i = 0; i < n; i++) {
		if (dfs(i, -1) == 1) ans.push_back(i + 1);
	}
	
	for (i = 0; i < ans.size(); i++) {
		if (i > 0) putchar(' ');
		
		printf("%d", ans[i]);
	}
	puts("");
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int n,a,b,c;
    while (cin>>n){if(n == 0) break;
   
    for(int i=0; i<n ;i++){
        cin >> a >>b >> c;  
    
    if (a==100 || b==100 || c==100) cout << "A" <<endl;
    else if ((a+b)/2>=90) cout << "A" <<endl;
    else if ((a+b+c)/3>=80) cout << "A" <<endl;
    else if ((a+b+c)/3>=70) cout << "B" <<endl;
    else if ((a+b+c)/3>=50 && a >=80 ) cout << "B" <<endl;
    else if ((a+b+c)/3>=50 && b >=80 ) cout << "B" <<endl;
    else cout << "C" <<endl;   
    }
    }
}



Measured memory_bytes: 2996
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int n;
	char a[100001];
	int s;
	int x;
		scanf("%s", a);
		n = strlen(a);
	s = n / 2;
	for (int i = 0; i < n; i++){
		if (a[i] == 'p') x++;
	}
	printf("%d\n", s-x);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1 << LLONG_MAX;
const ll MOD = 1e9 + 7;
ll H, W, A, B;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> H >> W >> A >> B;
    vector<vector<int>> mtr(H, vector<int>(W));

    for (int h = 0; h < H; ++h) {
        string ans;
        if (h < B) {
            for (int i = 0; i < A; ++i) {
                ans += "1";
            }
            for (int i = A; i < W; ++i) {
                ans += "0";
            }
        } else {
            for (int i = 0; i < A; ++i) {
                ans += "0";
            }
            for (int i = A; i < W; ++i) {
                ans += "1";
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <cmath>

using namespace std;

int main()
{
	double x;
	cin >> x;

	double n = (-1.0 + sqrt(1.0 + 8 * x)) / 2.0;
	cout << ceil(n) << endl;

	return 0;
}

Measured memory_bytes: 256