akhauriyash/Code-Regression huggingface dataset:
program making_palindrome
  implicit none
  integer(8), parameter :: inf = 1e18
  integer :: n, i, l
  character(20) :: s(50, 2) = ''
  integer(8) :: c(50) = 0, m(50, 21, 2) = 0, x = inf
  logical :: u(50, 21, 2) = .false.
  read(*,*) n
  do i = 1, n
    read(*,*) s(i, 1), c(i)
    l = len_trim(s(i, 1))
    s(i, 2)(1:l) = reverse(s(i, 1)(1:l))
  end do
  do i = 1, n
    x = min(x, solve(i, 1, 1) + c(i))
  end do
  write(*,'(i0)') merge(x, -1_8, x < inf)
contains
  function reverse(s) result(res)
    character(*), intent(in) :: s
    character(len_trim(s)) :: res
    integer :: n, i
    n = len_trim(s)
    do i = 1, n
      res(i:i) = s(n - i + 1:n - i + 1)
    end do
  end
  recursive integer(8) function solve(i, j, k) result(res)
    integer, intent(in) :: i, j, k
    integer :: l, r, t, l1, l2
    logical :: f
    res = m(i, j, k)
    if (u(i, j, k)) return
    u(i, j, k) = .true.
    m(i, j, k) = inf
    l = j
    r = len_trim(s(i, k))
    f = .true.
    do while (l < r)
      if (s(i, k)(l:l) /= s(i, k)(r:r)) then
        f = .false.
        exit
      end if
      l = l + 1
      r = r - 1
    end do
    if (f) then
      m(i, j, k) = 0
      res = 0
      return
    end if
    l1 = len_trim(s(i, k))
    do t = 1, n
      l = j
      r = 1
      l2 = len_trim(s(t, 3 - k))
      do while (l <= l1 .and. r <= l2)
        if (s(i, k)(l:l) /= s(t, 3 - k)(r:r)) exit
        l = l + 1
        r = r + 1
      end do
      if (l == l1 + 1) then
        m(i, j, k) = min(m(i, j, k), solve(t, r, 3 - k) + c(t))
      end if
      if (r == l2 + 1) then
        m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))
      end if
    end do
    res = m(i, j, k)
  end
end program making_palindrome

Measured memory_bytes: 2908
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
string en="\n";
string t="hello";
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define LB(a,x) (lower_bound(aov(a),x)-a.begin())
#define UB(a,x) (upper_bound(aov(a),x)-a.begin())
typedef long long LL;
typedef unsigned long long ULL;
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        vi a,aa;
        l=0,s=0;
        a.pb(0);
        rep(i,n)
        {
            cin>>x;
            a.pb(x);
            l=abs(l-x);
            s+=l;
            l=x;
        }
        a.pb(0);
        l=abs(l-0);
        s+=l;
//        rep(i+1,n)
        for(i=1;i<n+1;i++)
        {
            x=s-(abs(a[i]-a[i-1])+abs(a[i+1]-a[i]));
            x+=abs(a[i+1]-a[i-1]);
            cout<<x<<en;
        }
    }
}



Measured memory_bytes: 1784
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.FileReader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.InputStream;

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

    static class DMakeThemEven {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            int[][] arr = new int[h + 1][w + 1];
            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    arr[i][j] = in.nextInt();
                }
            }
            StringBuilder res = new StringBuilder();
            int op = 0;
            outer:
            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    if (i == h && j == w) break outer;
                    if (j < w && arr[i][j] % 2 == 1) {
                        res.append(i).append(" ").append(j).append(" ").append(i).append(" ").append(j + 1).append("\n");
                        arr[i][j + 1]++;
                        op++;
                    } else if (j == w && arr[i][j] % 2 == 1) {
                        res.append(i).append(" ").append(j).append(" ").append(i + 1).append(" ").append(j).append("\n");
                        arr[i + 1][j]++;
                        op++;
                    }
                }
            }
            out.println(op);
            out.println(res);
        }

    }

    static class Scanner {
        private StringTokenizer st;
        private BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 47536
#include <iostream>
#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()
{
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    double s;
    s = w * h / 2;
    int flag = 0;
    if(w / 2 == x && h / 2 == y) flag = 1;
    printf("%f %d\n", s, flag);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
 int main(){
 int n,sum=0,x;
 cin>>n;
 if(n>=500){
    x=n/500;
    sum+=x*1000;
    n=n-x*500;
    if(n>=5){
        x=n/5;
        sum+=x*5;
    }
 }
 else if(n>=5){
    x=n/5;
        sum+=x*5;
 }
 printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 256
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np
N = int(input())
A = np.array(input().split())

rows = np.concatenate([np.arange(N), np.arange(N)])
cols = np.concatenate([np.arange(N), np.arange(1,N+1) % N])
mat = csr_matrix(([1] * (2*N), (rows, cols)), (N,N))

answer = (spsolve(mat,A) * 2 + .5).astype(int)
print(*answer)

Measured memory_bytes: 67912
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
int main() {
  int N; cin >> N;
  int ans = 1;
  for(int i=2; ; ++i) {
    if(i*i > N) break;
    for(int j=1; ; ++j) {
      int tmp = pow(i,j);
      if(tmp > N) break;
      if( tmp > ans) ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 0
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	for solve(scanner, writer) {

	}
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) bool {
	sol := solver{}
	sol.w = getNextInt(scanner)
	sol.h = getNextInt(scanner)
	if sol.w == 0 && sol.h == 0 {
		return false
	}
	sol.land = makeInts(sol.h, sol.w)
	for y := 0; y < sol.h; y++ {
		for x := 0; x < sol.w; x++ {
			sol.land[y][x] = getNextInt(scanner)
		}
	}
	ans := 0
	for y := 0; y < sol.h; y++ {
		for x := 0; x < sol.w; x++ {
			if sol.land[y][x] == 0 {
				continue
			}
			ans++
			sol.dfs(y, x)
		}
	}
	fmt.Fprintln(writer, ans)
	return true
}

type solver struct {
	w, h int
	land [][]int
}

func (sol *solver) dfs(y, x int) {
	if y < 0 {
		return
	}
	if y >= sol.h {
		return
	}
	if x < 0 {
		return
	}
	if x >= sol.w {
		return
	}
	if sol.land[y][x] == 0 {
		return
	}
	sol.land[y][x] = 0
	dy := [8]int{-1, -1, -1, 0, 0, 1, 1, 1}
	dx := [8]int{-1, 0, 1, -1, 1, -1, 0, 1}
	for i := 0; i < 8; i++ {
		sol.dfs(y+dy[i], x+dx[i])
	}
}
func makeInts(h, w int) [][]int {
	index := make([][]int, h, h)
	data := make([]int, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}



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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	vector<int32> a;
	cin >> N;
	a.resize(N);
	vector<int32> cnt(N, 0);
	REP(i, N){
		cin >> a[i];
	}
	REP(i, N){
		FOR(j, i+1, N){
			if(abs(a[i]-a[j])%(N-1) == 0){
				cout << a[i] << " " << a[j] << endl;
				return 0;
			}
		}
	}

}


Measured memory_bytes: 3192
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string output = string.Empty;
            List<int> resultlist = new List<int>();

            int inputNum = int.Parse(Console.ReadLine());

            //?????¶????????´????????????????????????Add??????
            for(int i = 1; i <= inputNum; i++)
            {
                
                if(i % 3 == 0)
                {
                    resultlist.Add(i);
                    continue;
                }

                if(i.ToString().IndexOf("3") >= 0) resultlist.Add(i);
            }

            foreach(int result in resultlist)
            {
                string sumresult = result.ToString();

                output += " ";
                output += sumresult;
            }

            Console.WriteLine(output);

        }

    }

}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        String S = in.ns();
        long ans = 0;
        if(S.length()==1){
            ans = Long.parseLong(S);
        }else{
            String format = "%".concat(String.valueOf(S.length()-1)).concat("s"), s;
            for (int i = 0; i < (1 << (S.length()-1)); i++) {
                s = String.format(format, Long.toString(i,2)).replace(' ', '0');
                ArrayDeque<Integer> deq = new ArrayDeque<>();
                for (int j = 0; j < s.length(); j++) {
                    if(s.charAt(j)=='1') deq.addFirst(j);
                }
                int l = 0, r;
                while(!deq.isEmpty()){
                    r = deq.pollLast();
                    ans += Long.parseLong(S.substring(l, r+1));
                    l = r+1;
                }
                ans += Long.parseLong(S.substring(l));
            }
        }
        out.println(ans);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  int n=A*100,m=0;
  vector<bool> V2(F/A+1,false);
  V2[0]=true;
  for(int i=1;i<=F/A;i++){
    if((i-A>=0 && V2[i-A]) || (i-B>=0 && V2[i-B])){
      V2[i]=true;
      vector<bool> V(100000);
      V[0]=true;
      for(int j=1;j<=E*i && j<=F-i*100;j++){
        if((j-C>=0 && V[j-C]) || (j-D>=0 && V[j-D])){
          V[j]=true;
          if(m*(i*100+j)<j*n)
            n=(i*100+j),m=j;
        }
      }
    }
  }
  cout<<n<<' '<<m<<endl;
}

Measured memory_bytes: 3604
#include <iostream>

template <class T>
static T LowClear(T x) noexcept {
	T ts = 1;
	while(ts < T(sizeof(T)*8/2)) {
		x = x | (x >> ts);
		ts <<= 1;
	}
	return x & ~(x>>1);
}
static uint32_t MSB(uint32_t x) noexcept {
	x |= 0x01;
	return LowClear(x);
}

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

	int n;
	std::cin >> n;
	n = MSB(n);
	std::cout << n << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    int c[n+1];
    fill(c, c+n+1, 0);
    while (m--) {
        int a, b; cin >> a >> b; c[a]++; c[b]++;
    }
    for (int i = 1; i <= n; i++) if (c[i] % 2 == 1) { cout << "NO\n"; return 0; }
    cout << "YES\n";
}


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

int main()
{
    int a, b, x;

    cin >> a >> b >> x;

    double s = (double)x / (double)a;

    double theta = 0;

    if(s < (double)(a*b)/2.0)
    {
        double c = s*2.0/(double)b;
        // cout << c << ", " << b << endl;
        theta = atan2((double)b, c);
    }
    else
    {
        double c = (s - (double)(a*b)/2.0) * 2.0 / (double)a;
        // cout << a << ", " << b-c << endl;;
        theta = atan2((double)b - c, (double)a);
    }

    cout << std::setprecision(10) << theta * 180 / M_PI << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int r;
	int g;
	int b;
	scanf("%d", &r);
	scanf("%d", &g);
	scanf("%d", &b);
	int A = (10*g + b) % 4;
	if(A == 0){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
}

Measured memory_bytes: 128
## coding: UTF-8

s = input()
t = input()


ls = []
lt = []
for i in range(len(s)):
    ls.append(s[i])
for j in range(len(t)):
    lt.append(t[j])

ls.sort()
lt.sort(reverse = True)
#print('ls:{}, lt:{}'.format(ls, lt))
s_min = (''.join(ls))
t_max = (''.join(lt))
#print('s_min:{}, t_max:{}'.format(s_min, t_max))

#print(s_min < t_max)
if(s_min < t_max):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
def lcs_hs(s1, s2):
    from bisect import bisect_left

    p = []
    append_p = p.append
    for i, c in enumerate(s1):
        j = s2.find(c)+1
        while j:
            append_p((i, -j))
            j = s2.find(c, j)+1

    lis, result = [], 0
    append_lis = lis.append
    for _, y in sorted(p):
        i = bisect_left(lis, -y)
        if i >= result:
            append_lis(-y)
            result += 1
        else:
            lis[i] = -y

    return result


print(*(lcs_hs(input(), input()) for _ in [0]*int(input())), sep="\n")


Measured memory_bytes: 123684
n = int(input())
A = list(map(int, input().split()))

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

mod = 10**9 + 7
total = 0
for a in A:
    total += a
    total %= mod

sq = 0
for a in A:
    sq += a**2
    sq %= mod

inv = mod_inv(2, mod)

ans = (total**2 - sq) * inv
ans %= mod
print(ans)

Measured memory_bytes: 93932
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

const int inf = 1e9 + 7;
const ll inf_ll = 1e18L + 7;

template <typename T>
void mini(T& a, T b) {
  a = min(a, b);
}

template <typename T>
void maxi(T& a, T b) {
  a = max(a, b);
}

vector<int> topOrder(const vector<vector<int>>& g, vector<int>& in_deg) {
  queue<int> Q;
  for (int i = 1; i < (int)g.size(); ++i)
    if (in_deg[i] == 0) Q.push(i);

  vector<int> ans;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    ans.push_back(u);
    for (int v : g[u]) {
      --in_deg[v];
      if (in_deg[v] == 0) Q.push(v);
    }
  }
  return ans;
}

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<vector<int>> g(n + 1);
  vector<int> in_deg(n + 1);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    in_deg[v]++;
  }
  vector<int> order = topOrder(g, in_deg);

  vector<int> dp(n + 1, 0);
  for (size_t i = 0; i < order.size(); ++i)
    for (int v : g[order[i]]) {
      dp[v] = max(dp[v], dp[order[i]] + 1);
    }
  int ret = *max_element(begin(dp), end(dp));
  printf("%d", ret);
  return 0;
}


Measured memory_bytes: 7032
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007


ll PowMod(ll n, ll p) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    ll t = PowMod(n, p / 2);
    return t * t % DIV;
  }
  return n * PowMod(n, p - 1) % DIV;
}

ll comb(ll n, ll r) {
  // 分母と分子。いい名前思いつかなかった
  ll res, deno, mole;
  res = deno = mole = 1;
  for (ll i = 0; i < r; i++) {
    mole *= (n - i);
    mole %= DIV;
    deno *= (r - i);
    deno %= DIV;
  }
  // 分母の逆元
  res = PowMod(deno, DIV - 2);
  res = (res * mole) % DIV;
  return res;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long X, Y;
    cin >> X >> Y;
    if(Y >= X / 2.0 && Y <= 2.0 * X && (X+Y) % 3 ==0)
    {
        long move_count = (X+Y)/3;
        // x軸への必要移動回数
        long x_move = (move_count * 2 - X);
        cout << comb(move_count, x_move) << endl;
    }
    else
        cout << 0 << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <stack>
#include <set>
#include <deque>
// #include "printer.cpp"
using namespace std;

const int H = 1e3 + 2, W = H;
int h, w;
int si, sj, di, dj;

char arr[H][W];
uint32_t dist[H][W];

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

int main(){
	memset(dist, (unsigned char)(-1), sizeof dist);
	cin >> h >> w >> si >> sj >> di >> dj;
	si--; sj--; di--; dj--;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> arr[i][j];
		}
	}
	deque< pair<int,int> > q;
	q.push_front({ si, sj });
	dist[si][sj] = 0;
	while(!q.empty()){
		int i = q.front().first, j = q.front().second;
		q.pop_front();
		for(int a = 0; a < 4; a++){
			if(i + dx[a] >= h || i + dx[a] < 0) continue;
			int b = a;
			if(j + dy[b] >= w || j + dy[b] < 0) continue;
			if(arr[i+dx[a]][j+dy[b]] == '#') continue;
			if(dist[i][j] < dist[i+dx[a]][j+dy[b]]){
				dist[i+dx[a]][j+dy[b]] = dist[i][j];
				q.push_front({ i+dx[a], j+dy[b] });
			}
		}
		for(int a = max(0, i - 2); a < min(i+3, h); a++){
			for(int b = max(0, j - 2); b < min(j+3, w); b++){
				if(arr[a][b] == '#') continue;
				if(dist[i][j] + 1 < dist[a][b]){
					dist[a][b] = dist[i][j] + 1;
					q.push_back({ a, b });
				}
			}
		}
		/* for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(dist[i][j] == (uint32_t)(-1)) cout << 'M'  << ' ';
				else cout << dist[i][j] << ' ';
			}
			cout << '\n';
		}
		cout << '\n'; */
	}
	cout << (dist[di][dj] == (uint32_t)(-1) ? (int)-1 : (int)dist[di][dj]) << '\n';
	/* for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout << dist[i][j] << ' ';
		}
		cout << '\n';
	} */
}


Measured memory_bytes: 8500
n, m = map(int, input().split())
K = []
S = []
for _ in range(m):
    k, *s = map(int, input().split())
    K.append(k)
    S.append(s)
P = list(map(int, input().split()))

def ok_by_switch_state(ONs):
    for i in range(m):
        on_cnt = 0
        for s in S[i]:
            s -= 1
            on_cnt += (ONs & 1<<s) != 0
        if on_cnt % 2 != P[i]:
            return False
    else:
        return True
ans = 0
for i in range(2 ** n):
    ans += ok_by_switch_state(i)
print(ans)

Measured memory_bytes: 9084
N = gets.to_i
S = gets.to_s.chomp

if N % 2 != 0
  puts "No"
else
  tn = N / 2
  t = S.slice(0, tn)
  s = t << t

  if s.eql?(S)
    puts "Yes"
  else
    puts "No"
  end
end

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

using namespace std;

using ll = long long;

const ll MOD = 1000003;

ll modpow(ll x, ll n, ll mod = MOD) {
    if (x == 0) return 0;
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

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

    vector<ll> f(MOD, 1);
    for (int i = 1; i < MOD; i++) f[i] = f[i - 1] * i % MOD;

    for (int i = 0; i < q; i++) {
        ll x, d, n;
        cin >> x >> d >> n;
        if (n == 1) {
            cout << x % MOD << endl;
            continue;
        } else if (d == 0) {
            cout << modpow(x, n) % MOD << endl;
            continue;
        }

        ll hoge = x * modpow(d, MOD - 2) % MOD;
        ll foo = hoge + n - 1;
        if (hoge == 0 || foo - hoge >= MOD) {
            cout << 0 << endl;
        } else {
            foo %= MOD;
            if (foo == 0 || foo < hoge) cout << 0 << endl;
            else {
                cout << f[foo] * modpow(f[hoge - 1], MOD - 2) % MOD * modpow(d, n) % MOD << endl;
            } 
        }
    }
    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>

int main(){
  std::string str;
  
  std::cin >> str;
  
  if(str=="ABC"){
    std::cout << "ARC" << std::endl;
  }
  else if(str=="ARC"){
    std::cout << "ABC" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;

int main(){
    ll N,M,K;
    cin>>N>>M>>K;
    vector<ll> A(N+1,0);
    vector<ll> B(M+1,0);
    for(ll i=1;i<=N;i++){
        cin>>A[i];
    }
    for(ll i=1;i<=M;i++){
        cin>>B[i];
    }
    ll sum_now=0;
    ll sum_rest=0;
    ll max_cnt=0;
    ll j;
    for(ll i=0;i<=N;i++){
        if(i==0){
            j=1;
            while(sum_rest+B[j]<=K){
                sum_rest+=B[j];
                j++;
                if(j>M){
                    break;
                }
            }
            j--;
            max_cnt=max(max_cnt,j);
        }else{
            sum_now+=A[i];
            if(sum_now>K){
                break;
            }
            while(sum_rest+sum_now>K){
                sum_rest-=B[j];
                j--;
            }
            max_cnt=max(i+j,max_cnt);
        }
    }
    cout<<max_cnt<<endl;
    return 0;
}

Measured memory_bytes: 6316
#pragma warning(disable:4996)
#include<stdio.h>

int main(void) {
	int n, a;
	int ans[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a);
		ans[a - 1] = i + 1;
	}

	for (int i = 0; i < n; ++i) {
		printf("%d ", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 1152
// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int op(int a, int b) { return max(a, b); }

int e() { return -1; }

int target;

int main(){
    int n, k; cin >> n >> k;
    int ma = 0;
    vector<int> lis(n);
    REP(i, 0, n){
        cin >> lis[i];
        chmax(ma, lis[i]);
    }
    vector<int> se(ma+100, -1);
    segtree<int, op, e> seg(se);
    vector<int> dp(n, 1);
    vector<vector<int> > tree(n);
    REP(i, 0, n){
        int a = lis[i] - k, b = lis[i] + k;
        int ind1 = seg.prod(max(0, a), lis[i] + 1), ind2 = seg.prod(lis[i], min(b+1, ma + 10));
        if(ind1 != -1){
            //g.add_edge(ind1, i, 1);
            tree[i].pb(ind1);
        }
        if(ind2 != -1){
            //g.add_edge(ind2, i, 1);
            tree[i].pb(ind2);
        } 
        //cout << i << lis[i] << " " << ind1 << " "  << ind2 << endl;
        seg.set(lis[i], i);
    }
    int ans = 1;
    for(int i = n-1; i >= 0; i--){
        REP(l, 0, tree[i].size()){
            int next = tree[i][l];
            chmax(dp[next], dp[i]+1);
        }
        chmax(ans, dp[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 27320
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

ans = ["No", "Yes"]

# print(s)

flag = 0
for i in range(min(len(s), len(t))):
    if (s[i] < t[i]):
        flag = 1
        break
    elif (s[i] > t[i]):
        flag = 2
        break

if (len(s) < len(t)and flag == 0):
    flag = 1

print(ans[flag == 1])


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

//#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える


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

    int cnt = 0;
    rep(i, n-2){
        if(s.substr(i, 3) == "ABC") cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
mod = 1000000007
N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
T_max = 0
T_max_i = 0
for i in range(N):
    if T[i] > T_max:
        T_max = T[i]
        T_max_i = i
A_max = 0
A_max_i = 0
for i in range(N):
    if A[i] >= A_max:
        A_max = A[i]
        A_max_i = i
if T_max != A_max or T_max_i > A_max_i:
    print(0)
else:
    ans = 1
    h = 0
    for i in range(T_max_i + 1):
    	if T[i] > h:
    		h = T[i]
    	else:
    		ans = (ans * h) % mod
    for i in range(T_max_i + 1, A_max_i):
    	ans = (ans * h) % mod
    for i in range(A_max_i + 1, N):
    	if A[i] < h:
    		h = A[i]
    	else:
    		ans = (ans * h) % mod
    print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;

int main(){
    int W, H;
    cin >> W >> H; 

    vector<ll> P;
    vector<ll> Q;
    REP(i,W){
        ll p;
        cin >> p;
        P.push_back(p);
    }
    REP(i,H){
        ll q;
        cin >> q;
        Q.push_back(q);
    }

    sort(P.begin(), P.end());
    sort(Q.begin(), Q.end());

    int pi = 0;
    int qi = 0;
    ll ans = 0;
    while(pi < W || qi < H){
        ll p = 1e9;
        ll q = 1e9;
        if(pi < W) p = P[pi];
        if(qi < H) q = Q[qi];

        if(p >= q){
            ans += q * (1 + W - pi);
            qi++;
        }
        else{
            ans += p * (1 + H - qi);
            pi++;
        }
    }

    cout << ans << endl;
    return 0;
}


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

int main(){
    //input
    long long N;
    cin >> N;
    long long A[N+1];
    long long l,r;
    for(l=1; l<=N; l++){
        cin >> A[l];
    }

    //calc
    long long ans=0;
    long long xorval=0, val=0;
    r=1;
    for(l=1; l<=N; l++){
        if(l==r){
            xorval^=A[r];
            val+=A[r];
            r++;
        }
        if(r<=N){
            while((xorval^A[r])==(val+A[r])){
                xorval^=A[r];
                val+=A[r];
                r++;
                if(r>N) break;
            }
        }
        ans+=(r-l);
        xorval^=A[l];
        val-=A[l];
    }

    //output
    cout << ans << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 5228
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
#define N 1010
#define Max 0x3f3f3f3f
int n, m, x;
int maps[N][N], dis[N],  vis[N];
int dij(int x)
{
    int i, j, pos, Min, sum=0;
    for(i=0; i<=n; i++)
    {
        dis[i]=maps[i][x];
        vis[i]=0;
    }
    for(i=0; i<=n; i++)
    {
        Min=Max;
        for(j=0; j<=n; j++)
        {
            if(vis[j]==0 && dis[j]<Min)
            {
                pos=j;
                Min=dis[j];
            }
        }
        vis[pos]=1;
        for(j=0; j<=n; j++)
        {
            if(vis[j]==0 && dis[j]>maps[j][pos]+dis[pos])
                dis[j]=maps[j][pos]+dis[pos];
        }
    }
    for(i=0; i<=n; i++)
    {
        sum+=dis[i];
    }
    return sum;

}
int main()
{
    int i, j, a, b, c, MAX, ans, p;
    while(scanf("%d",&m), m)
    {
        n=0;
        memset(maps, Max, sizeof(maps));
        for(i=0; i<m; i++)
        {
            scanf("%d %d %d",&a,&b,&c);
            if(n<b)
                n=b;;
            maps[a][b]=maps[b][a]=min(maps[a][b], c);
        }
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=n;j++)
            {
                if(i==j)
                    maps[i][j]=0;
            }
        }
        MAX=Max;
        for(i=0;i<=n;i++)
        {

            ans=dij(i);
            if(MAX>ans)
            {
                p=i;
                MAX=ans;
            }
        }
        printf("%d %d\n", p, MAX);

    }
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s; cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}


Measured memory_bytes: 764
/*

साहिल पे पहुंचने से इनकार किसे है लेकिन,
तूफ़ानो से लड़ने का मज़ा ही कुछ और है,
कहते है, कि किस्मत खुदा लिखता है लेकिन,
उसे मिटा के खुद गढ़ने का मजा ही कुछ और है।

*/


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
using namespace std;
 
#define int                 long long int
#define ull					unsigned int
#define ld                  long double
#define pb                  push_back
#define ff                  first
#define ss                  second
#define S(arr)              sort(arr.begin(),arr.end());
#define RS(arr)              sort(arr.rbegin(),arr.rend());
#define R(arr)              reverse(arr.begin(),arr.end());
#define si                  set <int>
#define vi                  vector <int>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vpp                 vector <pair<int, pii>>
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define spi                 set <pii>
#define speed               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl                "\n"
#define all(p)              p.begin(), p.end()
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(t)             priority_queue <t>
#define que_min(t)             priority_queue <t, vector<t>, greater<t>>
#define debuga(a, l, r)     for(auto x:a)cout<<x<<" ";cout<<endl;
#define debug1(x)           cout << #x " = " << x << endl;
#define debug2(x,y)         cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x,y,z)       cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x,y,z,w)     cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x,y,z,w,v)   cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define debug6(x,y,z,w,v,a) debug3(a, y, x)debug3(w, v, a)
#define p2d(v)     	    for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)      	    for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppi(v)	for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;

 
void read(int n=10){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    #ifndef ONLINE_JUDGE
         freopen("input.txt",  "r",  stdin);
         freopen("output.txt", "w", stdout);
    #endif
}

int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005



int32_t main(){
	//read();
	int n;
	cin>>n;
	vi arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int curr=1;
	int coount=0;
	for(int i=0;i<n;i++){
		if(arr[i]==curr){
			curr++;
		}else{
			coount++;
		}
	}if(coount<n){
	cout<<coount<<endl;}
	else cout<<-1;
} 

Measured memory_bytes: 1792
def multiple(list_a, list_b):
  ans = [0] * len(list_a)
  
  for i in range(len(list_a)):
    ans[i] = list_a[i] * list_b[i]
  
  return ans

n, m, c = [int(x) for x in input().split()]

b = [int(x) for x in input().split()]

count = 0
for _ in range(n):
  na = [int(x) for x in input().split()]
  if sum(multiple(na, b)) + c > 0:
    count += 1

print(count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/

int main() {
    ll x;
    sld(x)
    ll a = (x / 11 )* 2;
    ll b = x % 11;
    if( b == 0){

    }else if(b <= 6){
        a++;
    }else{
        a ++;a++;
    }
    pld(a) pn
    return 0;
}



 //1 1 1 1 2 2 2 3 3 5 6 6 8 8 11


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 59; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll k;
cin >> k;
if(k==1){
    cout << 2 << endl;
    cout << 0 <<  " " << 2 << endl;
    return 0;
}
if(k==0){
    cout << 2 << endl;
    if(k%2){
        cout << k <<  " " << 1 << endl;
    }
    else{
        cout << k+1 <<  " " << 0 << endl;
    }
    return 0;
}
ll sy=k/50;
ll am=k%50;
vector<ll> v;
rep(i,am)v.push_back(100-am);
rep(i,50-am)v.push_back(49-am);
rep(i,50){
    v[i]+=sy;
}

cout << 50 << endl;
for (auto& u : v) {
    cout << u << " ";
}cout  << endl;
return 0;
}


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

int main() {
    string s, t;
    vector<int> u(30, -1), v(30, -1);
    cin >> s >> t;
    for (size_t i = 0; i < s.size(); i++) {
        int p = s[i] - 'a', q = t[i] - 'a';
        if (u[p] == -1) u[p] = q;
        else if (u[p] != q) {
            cout << "No" << endl;
            return 0;
        }
        if (v[q] == -1) v[q] = p;
        else if (v[q] != p) {
            cout << "No" << endl;
            return 0;
        }        
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  LL n, k;
  cin >> n >> k;
  const int mod = 1e9 + 7;

  LL ans = 0;
  for (LL i = k; i <= n + 1; i ++) {
    ans += -1 * i * i + (n + 1) * i + 1;
    ans %= mod;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
string s[110];
int co[30] = { 0 };
int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
		for (int j = 0; j < w; j++) {
			co[int(s[i][j] - 'a')]++;
		}
	}
	if (h % 2 == 0 && w % 2 == 0) {
		for (int i = 0; i < 26; i++) {
			if (co[i] % 4 != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
		return 0;
	}
	else if (h % 2 == 1 && w % 2 == 1) {
		bool b = false;
		int ans = 0;
		for (int i = 0; i < 26; i++) {
			if (co[i] % 2 != 0) {
				if (b) {
					cout << "No" << endl;
					return 0;
				}
				b = true;
			}
			else if (co[i] % 4 != 0 && co[i] % 2 == 0) {
				int m = 1000000007;
				for (int j = 1; j <= 10100; j += 2) {
					if (co[i] % j == 0) {
						if (m > co[i] / j) {
							m = co[i] / j;
						}
					}
				}
				ans += m;
			}
		}
		if (b && h + w - 2 >= ans) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		return 0;
	}
	else {
		int ans = 0;
		for (int i = 0; i < 26; i++) {
			if (co[i] % 2 != 0) {
				cout << "No" << endl;
				return 0;
			}
			if (co[i] % 4 != 0 && co[i] % 2 == 0) {
				int m = 1000000007;
				for (int j = 1; j <= 10100; j += 2) {
					if (co[i] % j == 0) {
						if (m > co[i] / j) {
							m = co[i] / j;
						}
					}
				}
				ans += m;
			}
		}
		int ans1;
		if (h % 2 == 0) {
			ans1 = h;
		}
		else {
			ans1 = w;
		}
		if (ans1 >= ans) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define pii pair< ll,ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define ll long long int
#define mod 1000000006
#define mxn 10000002

#define loop(v,i)  for(auto it=v[i].begin();it!=v[i].end();it++)
#define rep(i,a,b) for (int i = a; i < b; i++)
int main()
{
     ios::sync_with_stdio(0);
     cout.tie(0);
     cin.tie(0);
     string s;
     ll k,i,j;
     cin>>s;
     cin>>k;
     vector<string> v;
     set<string>ss;
     for(i=0;i<s.size();i++)
     {
      string p;
      for(j=i;j<min(i+7,(ll)s.size());j++)
      {
        p.pb(s[j]);
        if(ss.find(p)==ss.end())
          v.pb(p);

        ss.insert(p);

      }
     }
     sort(all(v));
     cout<<v[k-1];
    
}

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

int main(){
  string S;
  cin >>S;
  vector<int> count(1);
  
  for(int i=0;i<S.size();i++){
    if (S.at(i)=='A'||S.at(i)=='T'||S.at(i)=='G'||S.at(i)=='C'){
      count.at(count.size()-1)++;
    }
    else{
      count.push_back(0);
    }
  }
  sort(count.begin(),count.end());
  reverse(count.begin(),count.end());
  cout << count.at(0)<<endl;
}

Measured memory_bytes: 256
from functools import lru_cache
N = int(input())
mod = 10**9+7

def check(s):
    for i in range(4):
        l=list(s)
        if i>0:
            l[i-1],l[i]=l[i],l[i-1]
        if "".join(l).count("AGC"):
            return False
    else:
        return True

@lru_cache(maxsize=None)
def dfp(i,seq):
    ret=0
    if i==N:
        return 1
    for s in ["A","G","C","T"]:
        if check(seq+s):
            ret=(ret+dfp(i+1,seq[1:]+s))%mod
    return ret

print(dfp(0,"TTT"))

Measured memory_bytes: 5572
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

ll n,a,b;
vector<ll> H;
bool check(ll mid){
	ll debug = mid;
	vector<ll> life(H);
	rep(i,n){
		life[i] -= b * debug;
		life[i] = max(life[i], (ll)0);
		mid -= (life[i]+a-b-1)/(a-b);
		if(debug == 2) cerr<<life[i]<<" "<<mid<<endl;
	}
	if(debug == 2){
		cerr<<mid<<endl;
	}
	if(mid >= 0) return true;
	return false;
}

int main(void){
	
	cin>>n>>a>>b;
	
	rep(i,n){
		ll h;cin>>h;
		H.push_back(h);
	}
	ll begin = -1, end = (ll)1e9;
	while(end-begin > 1){
		ll mid = (begin+end+1)/2;
		if(check(mid)){
			end = mid;
		}else{
			begin = mid;
		}
	}
	cout<<end<<endl;
	return 0;
}


Measured memory_bytes: 1908
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<long long> a(3 * N);
    for (int i = 0; i < 3*N; i++) cin >> a[i];

    sort(a.begin(), a.end(), greater<long long>());
    long long sum = 0;
    for (int i = 0; i < N; i++){
        sum += a[2*i +1];
    }
    cout << sum << endl;
}


Measured memory_bytes: 2560