akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
//#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1001001001;

int nx[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int ny[8] = {0, -1, -1, -1, 0, 1, 1, 1};

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> str(h);
  rep(i, h) cin >> str[i];
  vector<vector<int>> num(h, vector<int>(w, 0));
  rep(i, h) rep(j, w) {
    if (str[i][j] == '.')
      continue;
    else {
      num[i][j] = INF;
      int s = i;
      int t = j;
      int oi = s;
      int oj = t;
      for (int k = 0; k < 8; k++) {
        s = oi + nx[k];
        t = oj + ny[k];
        if (s < 0 || s >= h || t < 0 || t >= w) continue;
        num[s][t]++;
      }
    }
  }
  rep(i, h) {
    rep(j, w) {
      if (num[i][j] >= INF)
        cout << '#';
      else
        cout << num[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

int main(){
    int n, k; cin >> n >> k;
    bool have[n];
    rep(i, n) have[i] = false;
    rep(i, k){
        int d; cin >> d;
        rep(j, d){
            int a; cin >> a;
            have[--a] = true;
        }
    }

    int ans = 0;
    rep(i, n) if(!have[i]) ans++;
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-


def main():
    n, m, x, y = map(int, input().split())
    xs = list(map(int, input().split()))
    ys = list(map(int, input().split()))

    x_max = max(xs) + 1
    y_min = min(ys)

    if x_max > y_min:
        print('War')
        exit()

    if x_max == y_min:
        if x < x_max <= y:
            print('No War')
            exit()

    for z in range(x_max, y_min + 1):
        if x < z <= y:
            print('No War')
            exit()

    print('War')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ;
 
/*                        [Template]                        */
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define let auto
#define of :
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
const int mod = (int)1e9 + 7 ;
const int inf = (int)1e18 ;
/************************************************************/

_matrix(int) grid ;

void mxz( int &a, int b ){
	a = max( a, b ) ;
}

signed main(){
	async ;
	int R, C, K ; cin >> R >> C >> K ;
	grid = matrix<int>( R + 1, C + 1, 0 ) ;
	int r, c, v ;
	for( int i = 0 ; i < K ; i++ ) {
		cin >> r >> c >> v ;
		grid[r][c] = v ;
	}
	// int dp[ R + 1 ][ C + 1 ][ 4 ] = { 0 } ;
	let prev = matrix<int>( C + 1, 4, 0 ) ;
	let cur = matrix<int>( C + 1, 4, 0 ) ;
	int temp[ C + 1 ][ 4 ] = { 0 } ;
	int k = 1 ;
	for( int i = 1 ; i <= C ; i++ ){
		temp[i][3] = max( temp[i-1][3], temp[i-1][2] + grid[k][i] ) ;
		temp[i][2] = max( temp[i-1][2], temp[i-1][1] + grid[k][i] ) ;
		temp[i][1] = max( temp[i-1][1], grid[k][i] ) ;
	}
	for( int i = 1 ; i <= C ; i++ ){
		// for( int k = 1 ; k <= 3 ; k++ ) dp[1][i][k] = temp[i][k] ;
		for( int k = 1 ; k <= 3 ; k++ ) prev[i][k] = temp[i][k] ;
	}
	for( int i = 2 ; i <= R ; i++ ){
		for( int j = 1 ; j <= C ; j++ ){
			for( int k = 1 ; k <= 3 ; k++ ){
				// dp[i][j][k] = max( {dp[i-1][j][3] + grid[i][j], dp[i][j-1][k-1] + grid[i][j], dp[i][j-1][k] } ) ;
				cur[j][k] = max( { prev[j][3] + grid[i][j], cur[j-1][k-1] + grid[i][j], cur[j-1][k] } ) ;
			}
			// cur = matrix<int>( C + 1, 4, 0 ) ;
		}
		prev = cur ;
	}
	cout << prev[C][3] ;
	return 0 ;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;

  ll ans = 0;
  rep(i, n) {
    int add, sub;
    sub = i - a[i];
    add = i + a[i];
    ans += mp[sub];
    mp[add]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 21004
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int max = 0;
		int min = 0;
		int maxidx = 0;
		int minidx = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > 0) {
				if (a[i] > max) {
					max = a[i];
					maxidx = i + 1;
				}
			} else {
				if (a[i] < min) {
					min = a[i];
					minidx = i + 1;
				}
			}
		}

		int ans = 0;
		List<Integer> x = new ArrayList<>();
		List<Integer> y = new ArrayList<>();
		if (max > -min) {
			for (int i = 0; i < n; i++) {
				if (a[i] < 0) {
					x.add(maxidx);
					y.add(i + 1);
					ans++;
				}
			}
			for (int i = 1; i < n; i++) {
				x.add(i);
				y.add(i + 1);
				ans++;
			}
		} else {
			for (int i = 0; i < n; i++) {
				if (a[i] > 0) {
					x.add(minidx);
					y.add(i + 1);
					ans++;
				}
			}
			for (int i = n; i > 1; i--) {
				x.add(i);
				y.add(i - 1);
				ans++;
			}
		}
		System.out.println(ans);
		for (int i = 0; i < ans; i++) {
			System.out.println(x.get(i) + " " + y.get(i));
		}
	}
}


Measured memory_bytes: 25684
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, N, AB):
    c = Counter()

    ij = list(product([-1, 0, 1], repeat=2))
    for a, b in AB:
        for i, j in ij:
            c[(a+i, b+j)] += 1

    ans = Counter()
    for (i, j), v in c.items():
        if 2 <= i < H and 2 <= j < W:
            ans[v] += 1

    ans[0] = (H-2) * (W-2) - sum(ans.values())
    for i in range(10):
        print(ans[i])


def main():
    H, W, N = read_int_n()
    AB = [read_int_n() for _ in range(N)]

    slv(H, W, N, AB)


if __name__ == '__main__':
    main()


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

int count(string str){
    int num=0;
    for(int i=0; i < str.length() ; i++){
        if(str[i]== '1'){
            num+=1;
        }
    }
    return num;
}

int main (){
    string s;
    cin >> s;
    cout << count(s);
}

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

signed main(){
    stack<int> a;
    string s;
    while(cin >> s){
        if (s == "+"){
            int n1 = a.top(); a.pop();
            int n2 = a.top(); a.pop();
            a.push(n1+n2);
        }
        else if (s == "-"){
            int n1 = a.top(); a.pop();
            int n2 = a.top(); a.pop();
            a.push(n2-n1);
        }
        else if (s == "*"){
            int n1 = a.top(); a.pop();
            int n2 = a.top(); a.pop();
            a.push(n1*n2);
        }
        else{
            a.push(stoi(s));
        }
    }
    cout << a.top() << endl;
    return 0;
}


Measured memory_bytes: 3168
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using static System.Console;
class E { static void Main() => new J(); }
class J
{
	public const int Inf = 1073741789;
	int[] G() => ReadLine().Split().Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve() => WriteLine(string.Join(" ", Calc()));
	List<int> Calc()
	{
		var N = G()[0];
		var a = G();
		var r = new int[N];
		for (var i = 0; i < N; i++) r[--a[i]] = i;
		var par = new[] { new RMQ(a, 0), new RMQ(a, 1) };
		var q = new PQ();
		var d = new Dictionary<int, P>();
		Action<P> add = p => { if (p.r - p.l > 1) { var z = par[p.l & 1].Min(p); d[z] = p; q.Enqueue(z); } };
		add(new P(0, N));
		var L = new List<int>();
		while (q.N > 0)
		{
			int x = q.Dequeue(), i = r[x];
			var p = d[x];
			int f = p.l & 1, y = par[1 - f].Min(i + 1, p.r), j = r[y];
			L.Add(x + 1);
			L.Add(y + 1);
			add(new P(p.l, i));
			add(new P(i + 1, j));
			add(new P(j + 1, p.r));
		}
		return L;
	}
}
struct P
{
	public readonly int l, r;
	public P(int x, int y) { l = x; r = y; }
}
class RMQ
{
	readonly int M;
	readonly int[] s;
	public RMQ(int[] a, int f)
	{
		var N = a.Length;
		M = 1;
		while (M < N) M <<= 1;
		s = new int[2 * M - 1];
		for (var i = 0; i < 2 * M - 1; i++) s[i] = J.Inf;
		for (var i = f; i < N; i += 2) s[i + M - 1] = a[i];
		for (var i = M - 2; i >= 0; i--) s[i] = Math.Min(s[2 * i + 1], s[2 * i + 2]);
	}
	public int Min(P p) => Min(p.l, p.r);
	public int Min(int f, int t) => Min(f, t, 0, 0, M);
	int Min(int f, int t, int n, int l, int r)
	{
		if (t <= l || r <= f) return J.Inf;
		else if (f <= l && r <= t) return s[n];
		else return Math.Min(Min(f, t, 2 * n + 1, l, (l + r) >> 1), Min(f, t, 2 * n + 2, (l + r) >> 1, r));
	}
}
class PQ
{
	readonly List<int> l = new List<int>();
	public int N { get; private set; } = 0;
	public void Enqueue(int x)
	{
		var i = N++;
		l.Add(x);
		while (i > 0)
		{
			var p = (i - 1) / 2;
			if (l[p] <= x) break;
			l[i] = l[p];
			i = p;
		}
		l[i] = x;
	}
	public int Dequeue()
	{
		var v = l[0];
		var x = l[--N];
		l.RemoveAt(N);
		if (N == 0) return v;
		var i = 0;
		while (i * 2 + 1 < N)
		{
			var a = 2 * i + 1;
			var b = 2 * i + 2;
			if (b < N && l[b] < l[a]) a = b;
			if (l[a] >= x) break;
			l[i] = l[a];
			i = a;
		}
		l[i] = x;
		return v;
	}
}

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


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

	vector<int> kuro(N + 1), shiro(N + 1);
	int ans = (int)1e9;

	for (int i = 0; i < N; ++i) {
		if (S[i] == '#') {
			kuro[i + 1] = kuro[i] + 1;
			shiro[i + 1] = shiro[i];
		}
		else {
			kuro[i + 1] = kuro[i];
			shiro[i + 1] = shiro[i] + 1;
		}
	}


	for (int i = 0; i < N + 1; ++i) {
		int tmp = kuro[i] - kuro[0] + shiro[N] - shiro[i];
		ans = min(ans, tmp);
	}

	cout << ans << endl;

}



Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,a,b;
    ll ans=0;
    cin>>n>>a>>b;
    if(a==0)
        cout<<0<<endl;
    else
    {
        ll temp1=(a+b);
        ll temp2=n/temp1;
        ll nisi=temp2*(a+b);
        ll baki=n-nisi;
        if(baki>a)
            ans+=(a*temp2)+a;
        else
            ans+=(a*temp2)+baki;
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let main() =
    let N = read int
    let ss = Array.zeroCreate N
    let ts = Array.zeroCreate N
    for i in 0 .. N - 1 do
        let [| s; t |] = reada string
        let t = Convert.ToInt32(t)
        ss.[i] <- s
        ts.[i] <- t
    let X = read string
    let mutable idx = 0
    Array.iteri (fun i s ->
        if s = X then idx <- i) ss
    let idx = idx + 1
    match idx > N - 1 with
    | true -> 0
    | _ -> Array.sum ts.[idx..]
    |> puts

    ()

main()
writer.Close()


Measured memory_bytes: 11476
#include <iostream>
using namespace std;
int main() {
    int S,s,m,h;
    cin >> S;
    s = S%60;
    m=((S-s)%3600)/60;
    h=(S-m-s)/3600;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
    
}

Measured memory_bytes: 1164
import fractions
a,b=map(int, input().split())
m=fractions.gcd(a,b)

pf={}

for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
print(len(pf)+1)

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	int N,K;
	cin >> N >> K;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	vector<int>dp(N, LIMIT);
	dp[0] = 0;
	for (int i = 0; i < N-1; i++) {
		for (int j = 1; j <= K && i + j < N; j++) {
			dp[i + j] = min(dp[i + j], abs(v[i] - v[i + j]) + dp[i]);
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i];

    }

    sort(all(v));
    vector<P> c;
    int cnt = 1;
    for(int i = 1; i < n; ++i) {
        if(v[i] != v[i - 1]) {
            c.pb(MP(cnt, v[i - 1]));
            cnt = 0;

        }
        ++cnt;
    }
    c.pb(MP(cnt, v[n - 1]));
    sort(all(c), greater<P>());
    int res = n;
    for(int i = 0; i < c.size(); ++i) {
        if(c[i].F == 1) continue;
        if(c[i].F % 2 == 0) {
            if(i + 1 < c.size()) c[i + 1].F--;
            res -= c[i].F;

        } else {
            res -= c[i].F - 1;

        }
    }
    cout << res << endl;
    return 0;
}



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

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())


def main():
    N = int(input())
    A = sorted(enumerate(map(int, input().split()), 1), key=lambda x: x[1])
    print(" ".join(str(i) for i, a in A))

main()


Measured memory_bytes: 23972
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

char ans[1000][1000];

string ex4 = "abccabddeeghffgh";
string ex5 = "aabbecd..ecd..if.hhifggjj";
string ex6 = "a..bbca..d.c.eedffgghi..j.hi..jkk.ll";
string ex7 = "aabbcc.dd...ef..g..ef..ghh.i..jll.i..j..mnkk...mn";

int main(){
#ifdef LOCAL
	//freopen("K_input.txt", "r", stdin);
	//freopen("K_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;

	if (n == 2){
		cout << -1;
		exit(0);
	}
	if (n == 3) {
		cout << "aab\nc.b\ncdd";
		exit(0);
	}

	for (int i=0;i<n;++i) for (int j=0;j<n;++j) ans[i][j] = '.';

	int index = 0;
	while (n - index > 7) {
		int u = 0;
		for (int i = index; i < index + 4; ++i) for (int j=index; j < index + 4; ++j) {
			ans[i][j] = ex4[u++];
		}
		index += 4;
	}

	int u = 0;

	if (n - index == 4) {
		for (int i = index; i < index + 4; ++i) for (int j=index; j < index + 4; ++j) {
			ans[i][j] = ex4[u++];
		}
	}

	if (n - index == 5) {
		for (int i = index; i < index + 5; ++i) for (int j=index; j < index + 5; ++j) {
			ans[i][j] = ex5[u++];
		}
	}	

	if (n - index == 6) {
		for (int i = index; i < index + 6; ++i) for (int j=index; j < index + 6; ++j) {
			ans[i][j] = ex6[u++];
		}
	}	

	if (n - index == 7) {
		for (int i = index; i < index + 7; ++i) for (int j=index; j < index + 7; ++j) {
			ans[i][j] = ex7[u++];
		}
	}		

	for (int i=0;i<n; ++i){
		for (int j=0;j<n;++j) cout << ans[i][j];
		cout << "\n";
	}


}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    cin >> A;
    REP(i, N - 1) {
        A[i + 1] += A[i];
    }

    vector<int> b;
    b.reserve(N * N / 2);
    REP(i, N) {
        REPF(j, i, N) {
            int t = A[j] - (i > 0 ? A[i - 1] : 0);
            b.push_back(t);
        }
    }

    int ans = 0;
    REPR(j, 60) {
        vector<int> tmp;
        int cnt = 0;
        REP(i, SZ(b)) {
            if ((b[i] >> j) & 1) {
                cnt++;
                tmp.push_back(b[i]);
            }
        }
        if (cnt >= K) {
            b.swap(tmp);
            ans |= 1LL << j;
        }
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 9984
#include <iostream>

using namespace std;

int main()
{
    int r, g, b;
    cin >> r >> g >> b;

    int x = 100 * r + 10 * g + b;
    if (x % 4 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
    }

    println!("{}", ((100*n+1800*m) as u32) * 2_u32.pow(m as u32));

}


Measured memory_bytes: 2200
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,K,num,cnt=0;
cin>>N>>M;
map<int,int>m;
for(int i=0;i<N;i++){
    cin>>K;
    for(int j=0;j<K;j++){
        cin>>num;
        m[num]++;
    }
}
for(int i=0;i<=M;i++){
    if(m[i]==N)cnt++;
}
cout<<cnt;
return 0;
}

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;
using P = pair<int, int>;

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > to(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  const int INF = 1e9;
  vector<int> dist(n, INF);
  vector<int> parent(n);
  queue<int> q;
  q.push(0);
  dist[0];
  while (!q.empty()) {
    int from = q.front();
    q.pop();
    for (int t : to[from]) {
      if (dist[t] != INF) continue;
      dist[t] = dist[from] + 1;
      q.push(t);
      parent[t] = from;
    }
  }
  for (int d : dist) {
    if (d == INF) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) cout << parent[i] + 1 << endl;
  return 0;
}

Measured memory_bytes: 10656
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#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;
	std::vector<int> a(n);
	for(int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	auto b = a;
	std::sort(b.begin(), b.end());
	for(int i = 0; i < n; i++) {
		std::cout << (a[i] == b[n-1] ? b[n-2] : b[n-1]) << '\n';
	}
}

Measured memory_bytes: 3200
// Apna Time Aayega...
#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000000+7
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define inf 100000000000000000
int addMod(int x, int y)
{
    x += y;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

int mulMod(int x, int y)
{
    return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
    int z = 1;
    while(y)
    {
        if(y & 1) z = mulMod(z, x);
        x = mulMod(x, x);
        y >>= 1;
    }
    return z;
}

int inv(int x)
{
    return binpow(x, MOD - 2);
}

int divide(int x, int y)
{
    return mulMod(x, inv(y));
}

ll gcd(int a, int b) 
{   if (a == 0) return b; 
    if (b == 0) return a;  
    if (a == b) return a; 
    if (a > b)  return gcd(a-b, b); 
    return gcd(a, b-a); 
} 

ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

ll h(ll* A, int N){
    ll pro = 1;
    for(int i=0; i<N; ++i) pro = mulMod(A[i], pro);
    return pro;
}

ll f(ll* A, int N){
    int alpha = A[0];
    for(int i=1; i<N; ++i){
        alpha = gcd(alpha, A[i])%MOD;
    }
    return alpha;
}


int main(){
    FIO
    int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin>>k; k--;
    cout<<arr[k]<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n;
  int i;
  for(;;){
    scanf("%d",&n);
    if(n == 0) break;
    int s[n];
    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
    }
    int max;
    max =s[0];
    for(i=1;i<n;i++){
      if(max<=s[i]){max=s[i];}
    }
    int min;
    min =s[0];
    for(i=1;i<n;i++){
      if(min>=s[i]){min=s[i];}
    }
    ;
    int score=0;
    for(i=0;i<n;i++){
      score=score + s[i];
    }
    score= score - min - max;
    score= score / (n-2);
    printf("%d\n",score);
  }
   
  return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;
//vector<ll> vll;
ll num[ten52];

int main(void)
{
    long long int m,n,i,k;
    cin>>m>>n;
    for(i=0;i<=m;i++)
    {
        if((i*2+(m-i)*4)==n)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}





Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int N, Q;
    cin >> N >> Q;
    string S;
    vint l(Q), r(Q), ans(Q), t(N);
    cin >> S;
    rep(i, Q)
    {
        cin >> l[i] >> r[i];
    }
    for (int i = 0; i + 1 < N; i++)
    {
        if (S[i] == 'A' and S[i + 1] == 'C')
        {
            t[i + 1] = t[i] + 1;
        }
        else
            t[i + 1] = t[i];
    }
    rep(i, Q)
    {
        cout << t[r[i]-1] - t[l[i]-1] << "\n";
    }

    return 0;
}

Measured memory_bytes: 2640
# -*-coding: utf-8 -*-

import sys
import math

def gcd(a, b):
    if b == 0: 
        return a
    return gcd(b, a % b)

def lcm(x, y):
    return (x * y) // gcd(x, y)

def main():
    input = sys.stdin.readline
    a, b, c, d = map(int, input().split())
    a_1 = a - 1
    lcm_cd = lcm(c,d)
    
    a_1_c_count =  a_1 // c
    a_1_d_count =  a_1 // d
    a_lcm_count =  a_1 // lcm_cd

    a_1_result = a_1 - (a_1_c_count + a_1_d_count - a_lcm_count)


    b_c_count = b // c
    b_d_count = b // d
    b_lcm_count = b // lcm_cd

    b_result = (b) - (b_c_count + b_d_count - b_lcm_count)

    result = b_result - a_1_result

    print(result)
    return


if __name__ == '__main__':
    main()

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

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

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    map<int, int> m;
    rep(i, N){
        int a;
        cin >> a;
        m[a]++;
    }
    int ret = 0;
    for(auto p: m){
        if(p.first > p.second){
            ret += p.second;
        }
        else {
            ret += p.second - p.first;
        }
    }
    output(ret);
    
    return 0;
}


Measured memory_bytes: 4736
#include  <stdio.h>

int maxdiv(int x, int y){
    if(y == 0){
        return(x);
    }else{
        return(maxdiv(y, x % y));
    }
}

int main(void)
{
    int x, y;
    
    scanf("%d", &x);
    scanf("%d", &y);
    
    printf("%d\n", maxdiv(x, y));
    
    return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x,a;
    cin>>x>>a;
    if(x>=13)cout<<a<<endl;
    else if(x<=5)cout<<0<<endl;
    else cout<<a/2<<endl;
    return 0;
}


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

int main() {
  ll N=0,X=0,ans=0;
  cin >> N >> X;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  vector<ll>s(N);
  rep(i,N){
    s[i] = abs(A[i] - X);
  }
  ans = s[0];
  rep(i,N-1){
    ans = __gcd(ans,s[i+1]);
  }
  cout << ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

mint dp[2005][2005];

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n);
    vector<ll> t(m);
    rep(i, n) cin >> s[i];
    rep(i, m) cin >> t[i];
    dp[0][0] = mint(1);
    rep(i, 2005) {
        dp[i][0] = mint(1);
        dp[0][i] = mint(1);
    }

    rep(i, n) rep(j, m) {
        mint now = mint(0);
        if (s[i]==t[j]) now = dp[i][j];
        dp[i+1][j+1] += now;
        dp[i+1][j+1] += dp[i][j+1];
        dp[i+1][j+1] += dp[i+1][j];
        dp[i+1][j+1] -= dp[i][j];
    }

    mint ans = dp[n][m];
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll a, b, c[100005] = {}, z = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) cin >> c[i];
    for (int i = 2; i <= n; i++) {
        z += min((c[i] - c[i - 1]) * a, b);
    }
    cout << z;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll	        long long
#define all(v)      (v).begin() , (v).end()
#define vi          vector <ll>
#define vii         vector <pair<ll,ll>>
#define ii          pair<int,int>
#define lp(i,a,b)	for(int i=a;i<b;i++)
#define pb          push_back
#define F           first
#define S           second
const ll mod=1e9+7,MAX=2e3+5;

void fast();
int main()
{
    fast();
    int a,b;
    cin>>a>>b;
    if(a>b)
        cout<<"safe";
    else
        cout<<"unsafe";
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 3636
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, q ] <- readInts
	s <- getLine
	[ ls, rs ] <- transpose <$> replicateM q readInts
	let
		psum =  scanl (+) 0 $ detect_ac s
	mapM_ print $ solve psum ( map ( subtract 1 ) ls ) rs

detect_ac [] = []
detect_ac [_] = [ 0 ]
detect_ac (a:b:s)
	| a == 'A' && b == 'C' = 0 : 1 : detect_ac s
	| otherwise = 0 : detect_ac (b:s)

solve psum ls rs = runST $ do
	let
		n = length psum - 1
		q = length ls
	psum_a <- newArray ( 0, n + 1 ) 0 :: ST s ( STUArray s Int Int )
	forM ( zip [ 0 .. ] psum ) $ \( i, a ) -> do
		writeArray psum_a i a
	res <- newSTRef []
	forM ( zip ls rs ) $ \( l, r ) -> do
		a <- readArray psum_a $ l + 1
		b <- readArray psum_a r
		modifySTRef res ( b - a : )
	modifySTRef res reverse
	readSTRef res

Measured memory_bytes: 62204
count = gets.to_i

strs = []

count.times.each do
  strs << gets.chomp
end

memo = {}

strs.each do |str|
  s = str.chars.sort.join
  
  if memo.key?(s)
    memo[s] += 1
  else
    memo[s] = 0
  end
end

puts memo.values.map { |n| (0..n).to_a.inject(:+) }.inject(:+).to_i

Measured memory_bytes: 26236
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    
    vector<int> W(N);
    for(int i = 0; i < N; i++){
        cin >> W[i];
    }
    int ans = INT_MAX;
    for(int i = 0; i < N; i++){
        // S1とS2の合計値の宣言
        int s1_Sum = 0;
        int s2_Sum = 0;
        // S1とS2のエリアの合計値を求める
        for(int s1 = 0; s1 <= i; s1++) s1_Sum += W[s1];
        for(int s2 = i+1; s2 < N; s2++) s2_Sum += W[s2];
        //cout << s1_Sum << " " << s2_Sum << endl;
        ans = min(ans, abs(s1_Sum - s2_Sum));
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3152
N,M = map(int,input().split())
K = [list(map(int,input().split()))[1:] for i in range(M)]
P = list(map(int,input().split()))
ans = 0
for i in range(0,2 ** N):#0 ~ 3:00 ~ 11
  S = [0] * M
  for j in range(M):
    for k in range(N):
      if (i >> k & 1) and k + 1 in K[j]:
        S[j] += 1
  S = [i % 2 for i in S]
  if S == P:
    ans += 1
print(ans)

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

int main() {
  string S;
  cin >> S;
  bool b = false;
  int x, y = 0;
  if(S.at(0) == 'A') {
    for(int i = 2; i < S.size()-1; i++) {
      if(S.at(i) == 'C') {
        x++;
      }
    }
    for(int i = 0; i < S.size(); i++) {
      if(S.at(i) == 'a' || S.at(i) == 'b' || S.at(i) == 'c' || S.at(i) == 'd' || S.at(i) == 'e' || S.at(i) == 'f' || S.at(i) == 'g' || S.at(i) == 'h' || S.at(i) == 'i' || S.at(i) == 'j' || S.at(i) == 'k' || S.at(i) == 'l' || S.at(i) == 'm' || S.at(i) == 'n' || S.at(i) == 'o' || S.at(i) == 'p' || S.at(i) == 'q' || S.at(i) == 'r' || S.at(i) == 's' || S.at(i) == 't' || S.at(i) == 'u' || S.at(i) == 'v' || S.at(i) == 'w' || S.at(i) == 'x' || S.at(i) == 'y' || S.at(i) == 'z') {
        y++;
      }
    }
    if(x == 1 && y == S.size()-2) {
      b = true;    
    }
  }
  

  if(b == true) {
    cout << "AC" << endl;
  }
  else {
    cout << "WA" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int r;
  cin>>r;
  
  cout<<r*r<<endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

// https://atcoder.jp/contests/abc143/tasks/abc143_c
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

//		List<Integer> list = new ArrayList<Integer>();
//		for(int i=0;i<N;i++) {
//			list.add(sc.nextInt());
//		}

		int[] array = new int[N];
		for(int i=0;i<N;i++) {
			array[i]=sc.nextInt();
		}

		sc.close();

		Arrays.sort(array);
		int result = 0;

		for(int i=0;i<N;i++) {
//			int a = list.get(i);
			for(int j=i+1;j<N;j++) {
//				int b = list.get(j);
				for(int l=j+1;l<N;l++) {
//					int c = list.get(l);
					if((array[l]<array[i]+array[j])) {
						result++;
					}else {
						break;
					}
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 26060
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    FOR(i, 1, 10) {
        if(N % i == 0 && N / i < 10) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
using System;
class hoge
{
    static void Main(String[] args)
    {
        int input = int.Parse(Console.ReadLine());
        int h = input / 3600;
        int m = (input % 3600)/60;
        int s = input % 60;
        Console.WriteLine("{0}:{1}:{2}", h, m, s);
}}

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

using namespace std;
#define LL long long

const int MAXN = 1123;

int main () {

	char s[MAXN];
	scanf("%s", s);

	int n = strlen(s);

	set <int> c;
	c.insert ('A');
	c.insert ('C');
	c.insert ('G');
	c.insert ('T');

	vector <int> d (n);
	d[0] = c.count (s[0]);

	int mx = d[0];

	for (int i = 1; i < n; ++i) {
		if (c.count (s[i])) {
			d[i] = 1 + d[i-1];
		}
		else d[i] = 0;

		mx = max (mx, d[i]);
	}

	printf("%d\n", mx);



	return 0;
}


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

const long long K = 18, N = 55;

vector<long long> vv[1<<K];

long long C[N][N];

void pre() {
    for (long long i=0; i<N; i++) C[i][0] = 1;
    for (long long i=1; i<N; i++)
        for (long long j=1; j<N; j++)
            C[i][j] = C[i-1][j-1] + C[i-1][j];

    for (long long i=0; i<N; i++)
        for (long long j=1; j<N; j++)
            C[i][j] += C[i][j-1];
}

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


    long long n, k, S, T;
    cin>>n>>k>>S>>T;

    if ( (S&T) != S) {
        cout<<0<<endl;
        return 0;
    }

    for (long long i=0; i<n; i++) {
        long long x;
        cin>>x;

        if ((x&S) != S) continue;
        if ((x&T) != x) continue;

        for (long long mask = 0; mask < (1<<K); mask++) {
            if ((mask&S) != S) continue;
            if ((mask&T) != mask) continue;
            int ans = x & (~mask);
            vv[mask].push_back(ans);
        }
    }

    long long ans = 0;
    for (long long mask = 0; mask < (1<<K); mask++) {
        if ((mask&S) != S) continue;
        if ((mask&T) != mask) continue;
        sort(vv[mask].begin(), vv[mask].end());

        long long ww = 0;
        while (vv[mask].size()) {
            long long last = vv[mask].back();
            long long cnt = 0;
            while (vv[mask].size() && vv[mask].back() == last)  cnt++, vv[mask].pop_back();

            ww += C[cnt][k]-1;
        }

        long long bc = __builtin_popcount(mask);
        if (bc%2)   ans += ww;
        else        ans -= ww;
    }
    cout<<abs(ans)<<endl;
}


Measured memory_bytes: 145996
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
		ios_base::sync_with_stdio(0);
		int K,N;
		cin>>K>>N;
		for(int i=N-K+1;i<N+K;i++)cout<<i<<" ";
		return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


ll num[sz];



int main()
{

    ll x,d,n;

    cin>>n;
    d=0;

    x=n;

    while(x>0)
    {
        d+=(x%10);
        x=x/10;
    }

    if(n%d==0)py;
    else
        pn;

    return 0;
}



Measured memory_bytes: 256
class UnionFind:

    # n is element num
    def __init__(self, n):
        self.n = n
        self.parent = [-1] * (n + 1)
        self.rnk = [0]*(n+1)

    # find root of x node
    def find_root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find_root(self.parent[x])
            return self.parent[x]

    # union disjoint sets of x and y
    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)

        if x == y:
            return

        elif self.rnk[x] > self.rnk[y]:
            self.parent[x] += self.parent[y]  # update num of nodes in united tree
            self.parent[y] = x

        else:
            self.parent[y] += self.parent[x]
            self.parent[x] = y

            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1

    # check x and y are in same tree
    def is_same_tree(self, x, y):
        return self.find_root(x) == self.find_root(y)

    # count nodes in tree what x belong to
    def count_nodes(self, x):
        return -self.parent[self.find_root(x)]


def read_input():
    h, w = map(int, input().split())

    board = []
    for i in range(h):
        board.append([0 if c == '.' else 1 for c in input()])

    return h, w, board


def union(vec):
    u = UnionFind(len(vec))

    for i, (v1, v2) in enumerate(zip(vec, vec[1:])):
        if v1 == v2 == 0:
            u.unite(i, i + 1)

    return u

def submit():
    h, w, board = read_input()

    hunions = []
    for i in range(h):
        hunions.append(union(board[i]))

    wunions = []
    for j in range(w):
        v = [board[i][j] for i in range(h)]
        wunions.append(union(v))


    max_lit = 0
    for i in range(h):
        for j in range(w):
            if board[i][j] == 0:
                hv = hunions[i].count_nodes(j)
                wv = wunions[j].count_nodes(i)

                if max_lit < hv + wv - 1:
                    max_lit = hv + wv - 1


    print(max_lit)



if __name__ == '__main__':
    submit()


Measured memory_bytes: 201352
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    int _26 = 26;
    int d = sc.nextInt();
    int[] c = new int[_26];
    int[][] s = new int[d][_26];
    
    for(int i=0; i<_26; i++){
      c[i] = sc.nextInt();
    }
    for(int i=0; i<d; i++){
      for(int j=0; j<_26; j++){
        s[i][j] = sc.nextInt();
      }
    }
    
    int[] r = new int[d];
    int[] r_i = new int[d];
    for(int i=0; i<d; i++){
      r[i] = s[i][0];
      r_i[i] = 1;
      for(int j=1; j<_26; j++){
        if(r[i] < s[i][j]){
          r[i] = s[i][j];
          r_i[i] = j+1;
        }
      }
    }
    
    for(int i=0; i<d; i++)
      System.out.println(r_i[i]);
  }
}

Measured memory_bytes: 38068
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

var m map[int]int
var a, b, c, d int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x := intScanner()
	for i := 1; i <= 360; i++ {
		if (360*i)%x == 0 {
			fmt.Println(360 * i / x)
			break
		}
	}
}


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

int main(void){
	int n, k, r, s, p;
	char t[100000];

	cin >> n >> k >> r >> s >> p;
	for(int i = 0; i < n; i++) {
		cin >> t[i];
	}
	int ms = 0;
	for(int i = 0; i < k; i++) {
		int rs = 0, ss = 0, ps = 0;
		for(int j = i; j < n; j += k) {
			int trs = max(ss, ps) + (t[j] == 's' ? r : 0);
			int tss = max(rs, ps) + (t[j] == 'p' ? s : 0);
			int tps = max(rs, ss) + (t[j] == 'r' ? p : 0);
			rs = trs; ss = tss; ps = tps;
		}
		ms += max(rs, max(ss, ps));
	}
	cout << ms;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)

#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define MAX_INT 2147483647
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

//#define int long long

inline int in(){int x;std::cin>>x;return x;}
struct FAST {FAST(){cin.tie(0);ios::sync_with_stdio(false);}} Fast;
template <class X> void print(X hoge){ cout << hoge<< '\n'; }

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */ 

signed main(void)
{
  ll a, b, x;
  ll ans;

  cin >> a >> b >> x;

  ans = (ll)(b / x) - (ll)(a / x); 

  if (a % x == 0) {
    ans += 1;
  }

  print(ans);

  return 0; 
}


Measured memory_bytes: 256