akhauriyash/Code-Regression huggingface dataset:
import bisect

A, B, Q = map(int,input().split())
INF = 10**18
s_list = [-INF] +  [int(input()) for i in range(A)] + [INF]
t_list = [-INF] + [int(input()) for i in range(B)] + [INF]
x_list = [int(input()) for i in range(Q)]

for x in x_list:
    
    b, d = bisect.bisect_right(s_list, x), bisect.bisect_right(t_list, x)
    a = b - 1
    c = d - 1 
    ans = INF
    for s in [s_list[a], s_list[b]]:
        for t in [t_list[c], t_list[d]]:
            dist1 = abs(s-x) + abs(t-s)
            dist2 = abs(t-x) + abs(t-s)
            ans = min(ans, dist1,dist2)
    print(ans)


Measured memory_bytes: 17808
#include<iostream>
using namespace std;
int main()

{
	int n,count=0;
	cin>>n;
	int ar[n];

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

	for(int i=0;i<n;i+=2)
	{
		if(ar[i]%2!=0)
			count++;
	}

	cout<<count<<endl;
}	

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;

public class Main {
	public static void main(String[] args) {
		new Main().solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();
		double[] F = new double[200001];
		double[] G = new double[200001];
		{
			Arrays.fill(F, -1);
			Arrays.fill(G, -1);
		}
		F[1] = 0.5;
		G[1] = 1;
		for (int i = 2; i <= 200000; ++i) {
			F[i] = (1 + 2. / i) * F[i - 1] + 5. / (2 * i) * G[i - 1] + 1. / (2 * i) * i * (2 * i - 1);
			G[i] = (1 + 1d / i) * G[i - 1] + 1;
		}
		System.out.println(String.format("%.20f", F[n] * x + d * G[n]));
	}

	public static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

public class hello
{
    public static void Main()
    {
        var a10000 = new List<int>();
        GeneratePrime(a10000, 10000);
        var a = new List<int>();
        var n = int.Parse(Console.ReadLine().Trim());
        Console.Write("{0}:", n);
        if (IsPrime(n) && n > 100000) { Console.Write(" {0}", n); goto end2; }
        var on = n;
        var te = 1;
        foreach (var x in a10000)
        {
            while (true)
            {
                if (n % x == 0)
                {
                    Console.Write(" {0}", x);
                    n /= x;
                    te *= x;
                    if (te == on) goto end;
                }
                else break;
            }
        }
        end:;
        if (te < on)
        {
            n = on / te;
            te = 1;
            on = n;
            GeneratePrime(a, n);
            foreach (var x in a)
            {
                while (true)
                {
                    if (n % x == 0)
                    {
                        Console.Write(" {0}", x);
                        n /= x;
                        te *= x;
                        if (te == on) goto end2;
                    }
                    else break;
                }
            }
        }
        end2:;
        Console.WriteLine();
    }
    public static void GeneratePrime(List<int> primeList, int m)
    {
        int prime;
        var sqrtMax = Math.Sqrt(m);
        var searchList = Enumerable.Range(2, m - 1).ToList();
        do
        {
            prime = searchList.First();
            primeList.Add(prime);
            searchList.RemoveAll(n => n % prime == 0);
        }
        while (prime < sqrtMax);
        primeList.AddRange(searchList);
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; 
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                return false;
            }
        }
        return true;
    }
}

Measured memory_bytes: 9668
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

int h, w, map[1001][1001];

struct pos {
	int x, y;
};

std::queue<pair<pos, int> > que;

int check(int _X, int _Y) {
	int count = 0;
	for (int i = -1;i <= 1;i++) {
		for (int j = -1;j <= 1;j++) {
			if (map[_X + i][_Y + j] == -1)count++;
		}
	}
	return count;
}

bool Cl(int _X, int _Y) { return check(_X, _Y) >= map[_X][_Y]; };

void Break(int _x, int _y, int _wave) {
	pos p;
	p.x = _x, p.y = _y;
	que.push(make_pair(p, _wave));
}

int main() {
	cin >> h >> w;
	for (int i = 1;i <= h;i++) {
		for (int j = 1;j <= w;j++) {
			char c;
			cin >> c;
			if (c == '.')map[i][j] = -1;
			else map[i][j] = c - '0';
		}
	}
	for (int i = 2;i <= h - 1;i++) {
		for (int j = 2;j <= w - 1;j++) {
			if (Cl(i, j) && map[i][j] != -1)map[i][j] = 0, Break(i, j, 1);
			else if (map[i][j] != -1) {
				map[i][j] -= check(i, j);
			}
		}
	}
	int big = 0;
	while (que.size()) {
		pair<pos, int> P = que.front();
		que.pop();
		pos po;
		po = P.first;
		if (map[po.x][po.y] == -1)continue;
		big = std::max(big, P.second);
		map[po.x][po.y] = -1;
		for (int i = -1;i <= 1;i++) {
			for (int j = -1;j <= 1;j++) {
				pos tep;
				tep.x = po.x + i, tep.y = po.y + j;
				if (map[tep.x][tep.y] > 0)map[tep.x][tep.y]--;
				if (map[tep.x][tep.y] == 0)que.push(make_pair(tep, P.second+1));
			}
		}
	}
	cout << big << endl;
	return 0;
}

Measured memory_bytes: 5148
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=1e9+7;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
int check(int now){
	int ret=0;
	while(now%100==0){
		now/=100;
		ret++;
	}
	return ret;
}

int main(){
	int D,N;
	cin>>D>>N;
	int cnt=N;
	int now = 0;
	while(cnt>0){
		now++;
		if(check(now)==D){
			cnt--;
		}
	}
	cout<<now<<endl;
}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef unsigned long long int ullint;
std::string YesNo[] = {"No","Yes"};
#define loop(i,N) for(int i=0; i<(N); i++)
template<typename T>
auto sort_all(T& v) { return std::sort(v.begin(),v.end()); }
template<typename T>
auto sum_all(const T& v) { auto z = v[0]; z = 0;
    return std::accumulate(v.begin(),v.end(),z); }
template<typename T>
auto input(int N) {
    std::vector<T> v(N);
    loop(i,N) std::cin >> v[i];
    return std::move(v);
}

typedef llint Int;

int main(void)
{
    int N;
    cin >> N;
    vector<int> ans;
    int k, i = 0;
    for (int s=1; N!=0; s*=-1, N/=2, i++) {
        if (k = N & 1) {
            N -= s;
        }
        ans.push_back(k);
    }
    if (i==0) {
        cout << 0 << endl;
    } else {
        for(i--;i>=0;i--)
            cout << ans[i];
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N, M = [int(nm) for nm in input().split()]
X = [int(x) for x in input().split()]

if N >= M:
  print(0)
elif N == 1:
  ans = max(X) - min(X)
  print(ans)
else:
  X.sort()
  mn_X = X[0]
  for m in range(M):
    X[m] = X[m] - mn_X #一番座標が小さい点を原点とする

  DX = [] #隣り合う二点間の距離
  for mm in range(M-1):
    dx = X[mm+1] - X[mm] #隣り合う二点間の距離を求める
    DX.append(dx)
  #print(DX)
  
  DXX = list(tuple(DX))
  DXX.sort(reverse=True) #DXXのi=0,1,2,...,N-2、つまり大きい値を取ってきたい
  I = [] #「XをN個に分割するとき、どの座標で分割するか」
  for i in range(N-1):
    big_dx = DXX[i]
    idx = DX.index(big_dx)
    I.append(idx)
  I.sort()
  #print(I)
  
  #最初のコマは原点に置く
  move = X[I[0]] - 0
  #print(move)
  
  for j in range(0, N-2):
    move += (X[I[j+1]] - X[I[j]+1])
  #print(move)
  
  #最後のコマ
  move += (X[-1] - X[I[N-2]+1])
  
  print(move)

Measured memory_bytes: 13840
using System;

class D
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		long n = h[0], m = n - h[1] + 2;
		Console.WriteLine((-(n + 1) * m + (n + 3) * m * (m + 1) / 2 - m * (m + 1) * (2 * m + 1) / 6) % 1000000007);
	}
}


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

using namespace std;

int common_prefix_len(string ss, string t, int i) {
  int lim = min(ss.size() - i, t.size()), cur = 0;
  while (cur < lim && (ss[i + cur] == '?' || ss[i + cur] == t[cur])) {
    cur++;
  }

  return cur;
}

int main(int argc, const char *argv[]) {
  string ss, t;
  cin >> ss >> t;

  int offset = -1;
  for (int i = 0; i < ss.size(); i++) {
    if (common_prefix_len(ss, t, i) == t.size()) {
      offset = i;
    }
  }

  if (offset < 0) {
    cout << "UNRESTORABLE\n";
    return 0;
  }

  // replace '?'
  for (int i = 0; i < t.size(); i++) {
    ss[i + offset] = t[i];
  }

  for (int i = 0; i < ss.size(); i++) {
    if (ss[i] == '?') {
      ss[i] = 'a';
    }
  }

  cout << ss << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double dp[301][301][301];
int n;
double sushi(int o,int z, int t){
	if(z<0||o<0||t<0)
	return 0.0;
	
	if(dp[o][z][t]>=0.0)
	return  dp[o][z][t];
	
	return dp[o][z][t]= (o*sushi(o-1,z,t)+z*sushi(o+1,z-1,t)+t*sushi(o,z+1,t-1)+n)/(o+z+t);

}
int main(){
	
	int  o=0,z=0,t=0;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
	cin>>a[i];
	if(a[i]==2)
	z++;
	else if(a[i]==1)
	o++;
	else
	t++;
	}
	memset(dp,-1.0,sizeof (dp));
	dp[0][0][0]=0.0;

	cout<<fixed<<setprecision(12)<<sushi(o,z,t);
	
	
	
}

Measured memory_bytes: 216828
import java.util.*;
import java.util.Collections;

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

    System.out.println(Math.max(A * B, C * D));
  }
}


Measured memory_bytes: 21588
package main

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

var (
	BufferSize = 100000
)

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

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

// n個後の文字を返す
func convert(n int, s string) string {
	return "s"
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	s := scanStr(sc)
	sRune := []rune(s)

	for i := 0; i < len(sRune); i++ {
		// Z=90
		tmp := int(sRune[i]) + n
		if tmp > 90 {
			tmp -= 26
		}
		fmt.Printf("%s", string(tmp))
	}
	fmt.Printf("\n")
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0), cout.tie(0)
#define REP(a, b) for (int i = a; i <= b; i++)
int main()
{
    fastio;
    //freopen(input.txt, 'r', stdin);
    //freopen(output.txt,'w', stdout);
    string s,t;
    cin>>s>>t;
    ll a=s.length();
    int count=0;
    for (ll i = 0; i < a; i++)
    {
        if(s[i]!=t[i])
        {
            count++;
        }
    }
    cout<<count<<'\n';
    
}

Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;



int main() {
	int n;
	cin >> n;
	int num = n / 111;
	if (n % 111 != 0) {
		num++;
	}

	cout << num * 111 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int d=a/b;
        int r=a%b;
        double fa=a;
        double fb=b;
        double f=fa/fb;
        System.out.printf("%d %d %f\n", d,r,f);
        
    }
}

Measured memory_bytes: 26452
from collections import deque
from copy import deepcopy
def dfs(world,i,j):#コピーした世界と開始場所
  c=0
  mc=-1
  pos=deque()
  pos.append((i,j,c))
  while pos:
    i,j,c=pos.popleft()
    if world[i][j]=="#":
      continue
    if world[i+1][j]!="#":
      pos.append((i+1,j,c+1))
    if world[i-1][j]!="#":
      pos.append((i-1,j,c+1))
    if world[i][j+1]!="#":
      pos.append((i,j+1,c+1))
    if world[i][j-1]!="#":
      pos.append((i,j-1,c+1))
    world[i][j]="#"
    if mc<c:
      mc=c
  return mc
ans=0
H,W=map(int,input().split())
#１．シャープが壁の迷路を作る
world=[]
world.append(["#"]*(W+2))
for i in range(H):
  world.append(["#"]+list(input())+["#"])
world.append(["#"]*(W+2))
#作った
#dfsをすべての場所で行う
for i in range(H+2):
  for j in range(W+2):
    if world[i][j]==".":
      mc=dfs(deepcopy(world),i,j)
      if ans<mc:
        ans=mc
print(ans)


Measured memory_bytes: 55128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll x;
  cin >> x;
  ll ans = 0;
  ans += x / 500 * 1000;
  x %= 500;
  ans += x / 5 * 5;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, K, ans = 0;
    cin >> N >> K;
    vector<ll> h(N);
    Rep (i, N) {
        cin >> h[i];
        if (h[i] >= K) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static double Solve(int N, int K)
        {
            double p = 0;
            for (int i = 1; i <= N; ++i)
            {
                int j = 0;
                while ((i << j) < K) { ++j; }
                p += 1 / (Math.Pow(2, j) * N);
            }
            return p;
        }
        static void Main(string[] args)
        {
            int[] V = ReadInts();
            Console.WriteLine(Solve(V[0], V[1]));
        }
    }
}


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

def fact(N):
    ans = 1
    for i in range(1,N+1):
        ans *= i
        if(ans>(10**9)+7):
            ans = ans%((10**9)+7)
    return ans
    
def main(N,M):
    if(int(abs(N-M))>=2):
        print(0)
    elif(N==M):
        print((2*(fact(N))**2)%((10**9)+7))
    elif(N-M==1):
        print((N*(fact(M))**2)%((10**9)+7))
    elif(M-N==1):
        print((M*(fact(N))**2)%((10**9)+7))    

if __name__ == '__main__':
    N, M = map(int,(input().split()))
    main(N,M)

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

int main() {
	char S[3];
	cin >> S[0] >> S[1] >> S[2];

	int count = 700;
	for (int i = 0; i < 3; ++i){
		if (S[i] == 'o') count += 100;
	}
	cout << count << endl;
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    int max_ = 0, cnt = 0;
    rep(i, s.length()){
        if(s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T')
        cnt++;
        else cnt = 0;
        max_ = max(cnt, max_);
    }
    cout << max_ << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n,k;
  cin >> n >> k;
  int half = 0;
  int zero = 0;
  if(k % 2 == 0){
    int tmp = k/2;
    while(tmp <= n){
      half++;
      tmp += k;
    }
    tmp = k;
    while(tmp <= n){
      zero++;
      tmp += k;
    }
    cout << (int)(pow(zero,3)) + (int)(pow(half,3)) << endl;
  }
  else{
    int tmp = k;
    while(tmp <= n){
      zero++;
      tmp += k;
    }
    cout << (int)(pow(zero,3)) << endl;
  }
}

Measured memory_bytes: 384
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000000
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << "\n"
#define pr2(a,b)cout << a <<  " " <<b<< "\n"
#define pr3(a,b,c) cout << a <<" " << b << " " << c << "\n"

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
const int maxn = 2*1e5 + 10;


void solve(){
    int n,m;
    cin >> n >> m;

    int sum = 0;
    for(int i = 1;i<=m;i++){
        int a;
        cin >> a;
        sum+=a;

    }

    if(sum>n){cout << -1 << endl;}
    else cout << n-sum << endl;
    

} 

signed main() 
{   
    IOS;
    int t = 1;
    // cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int n,m,fa[MAXN];
struct edge{
	int u,v;
}e[MAXN];
ll ans[MAXN],sz[MAXN];
int get_fa(int x) 
{
	if(x==fa[x]) 
		return x;
	return fa[x]=get_fa(fa[x]);
}
int main() 
{
	cin>>n>>m;
	for(int i=1;i<=m;i++) 
	{
		cin>>e[i].u>>e[i].v;
	}
	for(int i=1;i<=n;i++) 
	{
		fa[i]=i;
		sz[i]=1;
	}
	ans[m]=(ll)n*(n-1)/2;
	for(int i=m;i>=1;i--) 
	{
		int u=get_fa(e[i].u),v=get_fa(e[i].v);
		if(u==v) 	
		    ans[i-1]=ans[i];
		else 
		{
			ans[i-1]=ans[i]-sz[v]*sz[u];
			sz[v]+=sz[u]; 
			fa[u]=v;
		}
	}
	for(int i=1;i<=m;i++) 
	   cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(/* arguments */) {
  ll n,m;
  cin>>n>>m;
  out((1900*m+100*(n-m))*POW(2,m));
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


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

int main() {
  int n;
  cin >> n;
  int ans = 10<<9+1;
  rep(i, n) {
    int a;
    cin >> a;
    int cnt = 0;
    while (a%2 == 0) {
      a/=2;
      cnt+=1;
    }
    if (ans > cnt) {
      ans=cnt;
    }   
  }
  cout << ans << endl;
}

Measured memory_bytes: 3564
import collections
from collections import deque
def clear_maze(s):

    INF=-10**9
    ans = [INF for i in range(n)]
    def bfs():
        d = deque()
        d.append(s)

        while len(d):
            v=1
            x = d.popleft()
            for i in range(len(b[x])):
                y=b[x][i]
                if ans[y] == INF:
                    d.append(y)
                    if ans[x]==v:
                        v+=1
                    ans[y]=v
                    v+=1
        return ans
    return bfs()

n=int(input())
a = [list(map(int, input().split())) for i in range(n-1)]
b = [[] for i in range(n)]

for i in range(n-1):
    b[a[i][0]-1].append(a[i][1]-1)


c=clear_maze(0)
print(max(c))
for i in range(n-1):
    print(c[a[i][1]-1])

Measured memory_bytes: 81112
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,d;cin>>a>>b>>c>>d;
  cout<<max(a*b,c*d)<<endl;

  return 0;

}


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

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

ll dp[N][2];

void dfs(vector<int> g[], int u, int v)
{
	dp[u][1] = dp[u][0] = 1;
	for (auto x : g[u])
	{
		if (x == v) continue;
		dfs(g, x, u);
		dp[u][1] *= (dp[x][0] + dp[x][1]);
		dp[u][1] %= MOD;
		dp[u][0] *= dp[x][1];
		dp[u][0] %= MOD;
	}
}

void solve()
{
	int n; cin >> n;
	vector<int> g[n];
	for (int i = 0; i < n-1; ++i)
	{
		int u, v; cin >> u >> v;
		g[--u].pb(--v);
		g[v].pb(u);
	}
	dfs(g, 0, -1);
	cout << (dp[0][0] + dp[0][1])%MOD;
}

//  ---------------------Template---------------------------
void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}

int main(void)
{
	auto start = chrono::high_resolution_clock::now();

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}
//  ---------------------Template---------------------------

Measured memory_bytes: 14208
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
	n %= 10;
	if (n == 3) {
		printf("bon\n");
	} else if (n == 0 || n == 1 || n == 6 || n == 8) {
		printf("pon\n");
	} else {
		printf("hon\n");
	}

  return 0;
}

Measured memory_bytes: 1648
#include<stdio.h>
#define N 100

int main(){
    int array[N];
    int n,i,j,v,k;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&array[i]);
    }
    
    for(k=0;k<n-1;k++){
        printf("%d ",array[k]);
    }
    printf("%d\n",array[k]);
    
    for(i=1;i<n;i++){
        v = array[i];
        j = i-1;
        while(j>=0 && array[j]>v){
            array[j+1] = array[j];
            j = j-1;
        }
        array[j+1] = v;
        
        for(k=0;k<n-1;k++){
            printf("%d ",array[k]);
        }
        printf("%d\n",array[k]);
    }
    
    return 0;
}



Measured memory_bytes: 2128
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int buf;
  cin>>buf;
  int n=buf+1;
  vector<int> a(n);
  for(int i=1;i<n;i++){
    cin>>a[i];
  }
  vector<int> r(n);
  r[0]=0;
  for(int i=1;i<n;i++){
    if(i%2==1) r[0]+=a[i];
    else r[0]-=a[i];
  }
  r[0]=r[0]/2;
  for(int i=1;i<buf;i++){
    r[i]=a[i]-r[i-1];
  }
  for(int i=0;i<buf;i++){
    cout<<r[i]*2<<" ";
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int k, x;
    while (cin >> k >> x)
    {
        for (int i = x - k + 1; i <= x + k - 1; i++)
        {
            if (i != x - k + 1)
            {
                cout << " ";
            }
            cout << i;
        }
        cout << endl;
    }
}

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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  
  for(int i =0 ; i < N ; i++){
      int l, r ;
      cin >> l >> r ;
    
    sum += r-l+1;
   
  }
  cout << sum << endl;
  
  
  // ここにプログラムを追記
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long X, K, D;
  cin >> X >> K >> D;
  X = abs(X);
  if (X / D >= K){
    cout << X - K * D << endl;
  } else {
    if (K % 2 == (X / D) % 2){
      cout << X % D << endl;
    } else {
      cout << D - X % D << endl;
    }
  }
}

Measured memory_bytes: 3632
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		int n = int.Parse(Console.ReadLine());
		var b = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		int t = b[0];
		int a = b[1];
		var h = Console.ReadLine().Split().Select(y => int.Parse(y)).ToArray();
		double[] kion = new double[n];
		double[] kyori = new double[n];
		double saiteki = 65535;
		int bangou = 0;
		
		
		for(int c=0; c!=n; c++){
			kion[c] = t-(h[c]*0.006);
			kyori[c] = Math.Abs(a-kion[c]);
			if(saiteki>kyori[c]){
				saiteki = kyori[c] ;
				bangou = c+1;
			}
		}
		
		Console.WriteLine(bangou);
		
	}
}

Measured memory_bytes: 13396
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>

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

using namespace std;

const double PI=acos(-1);

int main(){
	for(int n;scanf("%d",&n),n;){
		vector<double> theta;
		rep(i,n){
			theta.push_back(2*i*PI/n+0*PI/3);
			theta.push_back(2*i*PI/n+2*PI/3);
			theta.push_back(2*i*PI/n+4*PI/3);
		}
		rep(i,theta.size()) if(theta[i]>2*PI) theta[i]-=2*PI;
		sort(theta.begin(),theta.end());

		double ans=0;
		rep(i,theta.size()){
			double t1=theta[i],t2=theta[(i+1)%theta.size()];
			if(t2<t1) t2+=2*PI;
			double phi=(t2-t1)/2;
			double h=1/(1/tan(phi)+1/tan(PI/6));
			ans+=2*(1*h/2);
		}
		printf("%.9f\n",ans/3); // 一辺が 1/√3 なので面積は 1/3 倍
	}

	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;
typedef long long ll;

int main() {
  ll N,ans=0ll,cnt=0ll;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    ll tmp;
    cin>>tmp;
    if(tmp<0){
      cnt++;
      tmp = -tmp;
    }
    A[i]=tmp;
  }
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++){
    if(cnt%2==1 && i==0){
      ans-=A[i];
      continue;
    }
    ans+=A[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,*a=map(int,open(0).read().split())
    dp=deepcopy(a)
    dp[:n//2]=[0]*(n//2)
    for i in reversed(range(n//2)):
        if sum(dp[j] for j in range(i,n,i+1))%2!=a[i]:
            dp[i]=1
    #print(dp)
    d=[k+1 for k,v in enumerate(dp)if v==1]
    print(len(d))
    print(*d)
if __name__ == '__main__':
    main()

Measured memory_bytes: 109436
using System;
namespace QQ
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i < 10; i++)
                for (int j = 1; j < 10; j++)
                {
                    Console.WriteLine(i + "x" + j + "=" + i * j);
                }
            Console.Read();
        }
    }
}

Measured memory_bytes: 9056
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void to_adjacent_matrix(vector<vector<int> >& adjacent_list, vector<vector<int> >& adjacent_matrix);

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

    vector<vector<int> > vertex(n, vector<int>(n, -1));
    for (int i = 0; i < n; ++i) {
        int u, k;
        cin >> u >> k;

        for (int j = 0; j < k; ++j)
            cin >> vertex[i][j];
    }

    vector<vector<int> > adjacent(n, vector<int>(n, 0));
    to_adjacent_matrix(vertex, adjacent);

    for (int i = 0; i < n; ++i) {
        cout << adjacent[i][0];
        for (int j = 1; j < n; ++j)
            cout << ' ' << adjacent[i][j];
        cout << '\n';
    }
}

void to_adjacent_matrix(vector<vector<int> >& adjacent_list, vector<vector<int> >& adjacent_matrix)
{
    int n = adjacent_list.size();

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n && adjacent_list[i][j] != -1; ++j) {
            int adjacent = adjacent_list[i][j] - 1;
            if (adjacent < 0 || adjacent > n)
                continue;

            adjacent_matrix[i][adjacent] = 1;
        }
    }
}



Measured memory_bytes: 3248
import sys
sys.setrecursionlimit(100000)

MOD = 10**9 + 7
N, K = map(int,input().split())

G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int,input().split())
    a, b = a-1, b-1

    G[a].append(b)
    G[b].append(a)

# 頂点nowを根とする部分木の色の塗り方 (parが親の時)
#   ただしnowはすでに塗られているとする
def dfs(now, par):
    if K < len(G[now]): return 0

    res = 1

    if par == -1:
        colors = K-1
        for i in range(len(G[now])):
            res *= colors-i
            res %= MOD
    else:
        colors = K-2
        for i in range(len(G[now])-1):
            res *= colors-i
            res %= MOD

    for c in G[now]:
        if c == par: continue
        
        res *= dfs(c, now)
        res %= MOD
    
    return res

print(K * dfs(0,-1) % MOD)

Measured memory_bytes: 92396
//
//  abc128_f.cpp
//

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

int main () {
  int n;
  cin>>n;
  vector<int> seq(n);
  for (int i = 0; i < n; ++i) {
    cin>>seq[i];
  }
  
  long long ret = 0;
  for (int j = 1; j < n; ++j) {
    long long s = 0;
    for (int k = 0; j+k < n-1; k += j) {
      if (k>=(n-1-k) && (n-1) % j == 0) break;
      s += seq[k]+seq[n-1-k];
      ret = max(ret,s);
    }
  }
  
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
int main(){
    long long int n;
    long long int subn;
    cin >> n;
    subn = n;
    int sn = 0;
    while(n > 0){
        sn += n%10;
        n = n/10;
        //cout << n << endl;
    }
    //cout << subn <<' '<<sn << ' ' << endl;
    if(subn % sn == 0){
        cout << "Yes" << endl;
    }
    else if(subn % sn != 0){
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


ll N;
struct cnt { ll v; ll n; ll p; };

vector<vector<ll>> adj;
vector<vector<ll>> var;
vector<cnt> vsum;

void dfs1(int n=0,int p=-1) {
  vsum[n] = {1,1,p};
  for (auto x: adj[n]) {
    if (x==p) continue;
    dfs1(x,n);
    var[n].push_back(vsum[x].v);
    vsum[n].v += vsum[x].v;
    vsum[n].n = vsum[n].n*vsum[x].n%MOD;
  }
  ll now = 0;
  for (auto x: var[n]) {
    now += x;
    vsum[n].n = vsum[n].n*nck(now,x)%MOD;
  }
}

void dfs2(int n=0,int p=-1) {
  // cout << n << " " << p << endl;
  for (auto x: adj[n]) {
    if (x==p) continue;
    vsum[x].n = ((vsum[n].n * inv(nck(N-1,vsum[x].v)))%MOD)*nck(N-1,vsum[x].v-1)%MOD;
    dfs2(x,n);
  }
}


int main() {
  c_fac();
  cin >> N;
  adj.resize(N);
  var.resize(N); vsum.resize(N);
  rep(i,N-1) {
    int a, b; cin >> a >> b; a--; b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }

  dfs1(); dfs2();
  // rep(i,N) debug(all(var[i]));
  // rep(i,N) cout << vsum[i].v << " " << vsum[i].n << " " << vsum[i].p << endl;
  rep(i,N) cout << vsum[i].n << endl;
  return 0;
}

Measured memory_bytes: 35584
import numpy as np

N = int(input())

T, A = [int(i) for i in input().split()]

H = np.array([int(i) for i in input().split()])

temp = T - 0.006*H

temp_def = temp-A

temp_target = min(abs(temp_def))

ans = int(np.where(abs(temp_def) == temp_target)[0]) +1


print(ans)

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

typedef long long ll;

const int Maxn = 300005;

int n;
int a[Maxn];
ll res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < 3 * n; i++)
        scanf("%d", &a[i]);
    sort(a, a + 3 * n);
    for (int i = 1; i <= n; i++)
        res += a[3 * n - 2 * i];
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1408
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BATCoder solver = new BATCoder();
        solver.solve(1, in, out);
        out.close();
    }

    static class BATCoder {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();

            int answer = 0;
            int count = 0;

            for (char c : s.toCharArray()) {
                if ("ACGT".indexOf(c) != -1) {
                    count++;
                    answer = Math.max(answer, count);
                } else {
                    count = 0;
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N;
  while(cin >> N){
    vector<int> A(N); cin >> A;

    bool ans = true;

    for(auto x : A){
      if(x % 2 == 0){
        if(not (x % 3 == 0 or x % 5 == 0)){
          ans = false;
        }
      }
    }

    puts_all(ans ? "APPROVED" : "DENIED");
    
  }


  return 0;
}


Measured memory_bytes: 256
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLine >>= print . solve . map fromIntegral

solve :: [Double] -> Double
solve [t, x] = t / x 

readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

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

int main() {
  string s;
  cin >> s;
  int n = s.size(), c = 0, m = 1e5;
  for (int i=0; i<n; i++) {
    if (s[i] == 'g')
      c++;
    else
      c--;
  }
  cout << c/2 << endl;
  return 0;
}

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

int main(){
    int N,K;
    cin >> N;
    cin >> K;
    int tmp;
    int h[N];
    for(int i=0;i<N;i++){
    cin >> h[i];
    }

    int dp[N]={0};
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<N;i++){
        tmp=dp[i-1]+abs(h[i]-h[i-1]);
        for(int k=2;k<=K;k++){
            tmp=min(tmp,dp[max(i-k, 0)]+abs(h[i]-h[max(i-k, 0)]));
        }
        dp[i]=tmp;
    }

    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,a[MAXN],b[MAXN],c[MAXN],dp[MAXN][3];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                int res;
                if(k==0) res=a[i+1]; else if(k==1) res=b[i+1]; else res=c[i+1];
                if(j==k) continue;
                dp[i+1][k]=max(dp[i+1][k],dp[i][j]+res);
            }
        }
    }
    int ans=max(dp[n][0],max(dp[n][1],dp[n][2]));
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,x[102];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>x[i];
	}
	ll ans=INF;
	for(ll i=1;i<=100;i++){
		ll sum=0;
		for(ll j=0;j<n;j++){
			sum+=(x[j]-i)*(x[j]-i);
		}
		ans=min(ans,sum);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

inline int decode(string& s) {
    int ret = 0;
    int tmp = 0;
    for (char& c: s) {
        switch (c) {
            case 'm':
                if (tmp)
                    ret += tmp * 1000;
                else
                    ret += 1000;
                tmp = 0;
                break;
            case 'c':
                if (tmp)
                    ret += tmp * 100;
                else
                    ret += 100;
                tmp = 0;
                break;
            case 'x':
                if (tmp)
                    ret += tmp * 10;
                else
                    ret += 10;
                tmp = 0;
                break;
            case 'i':
                if (tmp)
                    ret += tmp * 1;
                else
                    ret += 1;
                tmp = 0;
                break;
            default:
                tmp = c - 48;
                break;
        }
    }
    return ret + tmp;
}

inline string encode(int n) {
    string ret;
    char c;
    c = n / 1000;
    if (c) {
        if (c != 1) {
            ret += (c + 48);
        }
        ret += 'm';
    }
    n %= 1000;
    c = n / 100;
    if (c) {
        if (c != 1) {
            ret += (c + 48);
        }
        ret += 'c';
    }
    n %= 100;
    c = n / 10;
    if (c) {
        if (c != 1) {
            ret += (c + 48);
        }
        ret += 'x';
    }
    n %= 10;
    c = n;
    if (c) {
        if (c != 1) {
            ret += (c + 48);
        }
        ret += 'i';
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    string a, b;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        cout << encode(decode(a) + decode(b)) << endl;
    }
    return 0;
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main() {
    bool ans=true;
  int x,y,a,b;
  cin>>x>>y;
  a=y-2*x;
  b=4*x-y;
  if(a>=0&&b>=0){
      if(a%2==0&&b%2==0){
          
      }else ans=false;
  }else{
      ans=false;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

using namespace std;

vector<int> Z(string s) {
    vector<int> z(s.size() , 0);
    int l = 0 , r = 0;
    for (int i = 1 ;i < s.size() ;i++) {
        if (i <= r)
            z[i] = min(z[i - l] , r - i + 1);

        while (i + z[i] < s.size() && s[i + z[i]] == s[z[i]])
            z[i]++;

        if (i + z[i] - 1 > r)
            l = i , r = i + z[i] - 1;
    }

    return z;
}

const int N = 1e6 + 5;
vector<int> adj[N];
int vis[N];

bool cycle(int node) {
    if (vis[node])
        return vis[node] == 1;

    vis[node] = 1;
    for (int c : adj[node])
        if (cycle(c))
            return 1;
    vis[node] = 2;

    return 0;
}

int memo[N];
int solve (int node) {
    int &ret = memo[node];
    if (~ret)
        return ret;

    ret = 0;
    for (int c : adj[node])
        ret = max(ret , solve(c) + 1);

    return ret;
}

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

    string s , t;
    cin >> s >> t;

    while (s.size() < t.size())
        s += s;

    int n = s.size();
    int m = t.size();

    vector<int> z = Z(t + "$" + s + s);
    int st = m + 1;
    int en = st + n - 1;

    for (int i = st ;i <= en ;i++)
        if (z[i] >= m)
            adj[i - st].push_back((i - st + m) % n);

    for (int i = 0 ;i < s.size() ;i++) {
        if (cycle(i)) {
            cout << -1;
            return 0;
        }
    }

    memset(memo , -1 , sizeof memo);
    int mx = 0;
    for (int i = 0 ;i < s.size() ;i++)
        mx = max(mx , solve(i));

    cout << mx;
}

Measured memory_bytes: 87528