akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    static int N;
    static int K;
    static int Q;
    static int[] V;
    // static int[] k;
    // static Condition[] st;
    // static int[] p;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextInt();
        V = new int[N];
        for (int i = 0; i < N; i++) {
            V[i] = sc.nextInt();
        }
        int ans = 0;
        for (int l = 0; l < N+1; l++) {
            for (int r = 0; r < N+1; r++) {
                if (l + r > Math.min(N,K)) continue;
                int cand = 0;
                PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
                for (int i = 0; i < l; i++) {
                    cand += V[i];
                    pq.add(V[i]);
                }
                for (int i = 0; i < r; i++) {
                    pq.add(V[N-1-i]);
                    cand += V[N-1-i];
                }
                int res = K - l - r;
                while(res > 0 && pq.size() > 0 && pq.peek() < 0) {
                    int v = pq.poll();
                    cand -= v;
                    res--;
                }
                ans = Math.max(ans,cand);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 24148
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a-c<=d&&a-c>=-d)
        printf("Yes\n");
    else if(a-b<=d&&a-b>=-d&&b-c<=d&&b-c>=-d) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func readInt() int {
	i, _ := strconv.Atoi(read())
	return i
}

func main() {
	s1 := []rune(read())
	s2 := []rune(read())
	s3 := []rune(read())

	fmt.Println(string(s1[0]) + string(s2[1]) + string(s3[2]))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(){
    string s;
    cin >> s;
    if(s[s.length() -1] == 's'){
        cout << s << "es" << endl;
    } else {
        cout << s << "s" << endl;
    }
}

Measured memory_bytes: 3616
import sys

N, P = map(int, input().split())
A = input()

ans = 0

if 10 % P == 0:
    for r in range(len(A)):
        if int(A[r]) % P == 0:
            ans += r + 1
    print(ans)
    sys.exit()


A = "0" + A[::-1]

S = [0] * len(A)
cnt = [0] * P
cnt[0] = 1

for i in range(len(A) - 1):
    S[i + 1] = (S[i] + int(A[i + 1]) * pow(10, i, P)) % P
    cnt[S[i + 1] % P] += 1
# print(S, cnt)

# ans = cnt[0] * (cnt[0] - 1) // 2
for c in cnt:
    ans += c * (c - 1) // 2
print(ans)


Measured memory_bytes: 44400
S = input()
LEN = len(S)

K = "keyence"

if K in S:
    print("YES")
else:
    isok = False
    LENK = len(K)
    for i in range(LENK):
        if K[0:i+1] == S[0:i+1] and \
        K[i+1:LENK] == S[LEN-LENK+(i+1):LEN]:
            isok = True
            break
    if isok:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long int x;
    cin >> x;
    long long int x500 = (x/500) * 1000;
    long long int tmp = x%500;
    long long int x5 = (tmp/5) * 5;
    tmp = tmp%50;
    cout << x500+x5 << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,A,B,C,D;
ll mo=1000000007;
ll ret;

const int NUM_=400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

int okok[1010][1010];
ll memo[1010][1010];

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll combi(ll N_, ll C_) {
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll dfs(int a,int l) {
	int i;
	
	ll& ret=memo[a][l];
	if(ret>=0) return ret;
	
	ret=0;
	if(l==0) {
		ret = 1;
	}
	else {
		if(a>B) return 0;
		ret += dfs(a+1,l);
		ll v=1;
		for(i=1;i<=D && a<=l;i++) {
			(v *= combi(l,a))%=mo;
			l-=a;
			(v *= inv[i])%=mo;
			
			if(i>=C && i<=D) {
				ret += v*dfs(a+1,l)%mo;
			}
		}
	}
	ret%=mo;
	return ret;
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>A>>B>>C>>D;
	
	MINUS(memo);
	combi(1,1);
	
	cout<<dfs(A,N)<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 17664
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Atcoder_Answer
{
    class Program
    {
        const Int32 mod = 1000000007;

        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            int[] Members = new int[N];

            for (int loop = 0; loop < N; loop++) Members[loop] = 0;

            string[] Reader = ReadLine().Split(' ');
            foreach (string str in Reader) Members[int.Parse(str) - 1]++;

            foreach (int mems in Members) WriteLine(mems.ToString());

            ReadKey();
        }
    }

    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion

        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion

        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion

        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion

        #region 拡張: string
        public static string Multi(this string THIS, int Value)
        {
            string RetValue = "";

            for (int loop = 0; loop < Value; loop++) RetValue += THIS;

            return RetValue;
        }
        #endregion

        #region 拡張: List<string>
        public static string Sum(this List<string> THIS, string Split)
        {
            string RetValue = "";

            for (int loop = 0; loop < THIS.Count; loop++)
            {
                RetValue += THIS[loop];
            }

            return RetValue;
        }
        #endregion
    }
}


Measured memory_bytes: 38364
#include<iostream>
using  namespace std;
int main(){
	int N,A,B;
	long long total=0;
	scanf("%d%d%d",&N,&A,&B);
	if(A>B){
		printf("0");
	}else if(A!=B && N == 1){
		printf("0");
	}else if(A==B){
		printf("1");
	}else{
		total += A+(long long)B*(N-1)+1;
		total -= B+(long long)A*(N-1);
		printf("%lld",total);
	}
}

Measured memory_bytes: 384
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int i;
    string s;
    cin>>s;
    int cnt=0;
    int mini=inf;
    rep(i,s.length()){
    	if(s[i]=='E')
    		cnt++;
    }
    rep(i,s.length()){
    	if(s[i]=='E')
    		cnt--;
    	mini=min(mini,cnt);
    	if(s[i]=='W')
    		cnt++;
    }
    cout<<mini<<endl;
    return 0;  
    
}



Measured memory_bytes: 720
#include <iostream>

using namespace std;
using int64    = long long;
using PII      = pair<int, int>;
const int MAXN = 3005;
const int INF  = 0x3f3f3f3f;
const int MOD  = 998244353;

int64 dp[MAXN][MAXN];
int a[MAXN];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    int n,s;
    cin >> n >> s;
    for(int i=1;i<=n;i++) cin >> a[i];
    dp[0][0]=1;
    for(int i=0;i<n;i++) {
        for(int j=0;j<=s;j++) {
            dp[i+1][j] = 2*dp[i][j];
            if(j>=a[i+1]) {
                dp[i+1][j] += dp[i][j-a[i+1]];
            }
            dp[i+1][j] %= MOD;
        }
    } 
    cout << dp[n][s] << endl;
}


Measured memory_bytes: 73628
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

int main() {
    int N, X, D;
    scanf("%d %d %d", &N, &X, &D);
    if (D == 0) {
        if (X == 0) return !printf("1\n");
        return !printf("%d\n", N + 1);
    }
    if (D < 0) {
        X *= -1;
        D *= -1;
    }
    map<LL, vector<pll>> V;
    LL lD = 0, rD = 0;//[l, r] D's coefficient
    for (LL i = 0; i <= N; i++) {
        LL cX = (i * X) % D;
        LL offs = (i * X) / D;
        V[cX].push_back(make_pair(lD + offs, rD + offs));
        lD += (i);
        rD += (N - 1 - i);
    }
    LL ans = 0;
    for (auto i : V) {
        vector<pll> tmpV = i.second;
        sort(tmpV.begin(), tmpV.end());
        LL l = 1, r = 0;
        for (int j = 0; j < (int)tmpV.size(); j++) {
            LL curl = tmpV[j].first, curr = tmpV[j].second;
            if (!j) {
                l = curl;
                r = curr;
                continue;
            }
            if (curl > r) {
                ans += (r - l + 1);
                l = curl;
                r = curr;
            } else {
                r = max(r, curr);
            }
        }
        ans += (r - l + 1);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 22144
local mma, mmi = math.max, math.min
local h, w = io.read("*n", "*n", "*l")
local map = {}
for j = 1, w do map[j] = {} end
for i = 1, h do
  local str = io.read()
  for j = 1, w do
    map[j][i] = str:sub(j, j):byte()
  end
end
local function solve(col)
  local mapl, mapr = map[col], map[col + 1]
  local cost = {}
  do
    cost[1] = {}
    local lv = mapl[1]
    for right = 1, h do
      local z = lv == mapr[right] and 1 or 0
      cost[1][right] = z
    end
  end
  for left = 2, h do
    cost[left] = {}
    local lv = mapl[left]
    do
      local z = lv == mapr[1] and 1 or 0
      cost[left][1] = z
    end
    for right = 2, h do
      local z = lv == mapr[right] and 1 or 0
      z = z + cost[left - 1][right - 1]
      cost[left][right] = z
    end
  end
  for sum = h * 2 - 1, 2, -1 do
    local dst_l_min, dst_l_max = mma(1, sum - h), mmi(h, sum - 1)
    for dst_l = dst_l_min, dst_l_max do
      local dst_r = sum - dst_l
      if dst_l == h then
        cost[h][dst_r] = cost[h][dst_r] + cost[h][dst_r + 1]
      elseif dst_r == h then
        cost[dst_l][h] = cost[dst_l][h] + cost[dst_l + 1][h]
      else
        cost[dst_l][dst_r] = cost[dst_l][dst_r] + mmi(cost[dst_l + 1][dst_r], cost[dst_l][dst_r + 1])
      end
    end
  end
  local res = cost[1][1]
  for i = 1, h do
    res = mmi(res, cost[i][1])
    res = mmi(res, cost[1][i])
  end
  return res
end

local ret = 0
for i = 1, w - 1 do
  ret = ret + solve(i)
end
print(ret)


Measured memory_bytes: 10240
# coding:utf-8
N = int(input())
inp = list(map(int, input().split()))

def gusuka(date):
    for i in range(N):
        if date[i]%2!=0:
            return False
    return True

count = 0
if gusuka(inp):
    count += 1
    while True:
        for i in range(N):
            inp[i] = inp[i]/2
        if gusuka(inp):
            count += 1
        else:
            break

print(count)


Measured memory_bytes: 3060
import java.io.*
import java.util.*

fun solve(N: Long, A: LongArray){
    println(A.max()!! - A.min()!!)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    val A = LongArray(N.toInt())
    for (i in 0 until N.toInt()) {
        A[i] = sc.next().toLong()
    }
    solve(N, A)
}



Measured memory_bytes: 34088
// 21:50 - 21:54
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> pint;

const int N = 50 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

ll s[N];

int main(){
	ios::sync_with_stdio(0);

	ll k; cin >> k;
	for(int i=1; i<=50; i++)
		s[i] = 49;
	ll a = k / 50, b = k % 50;
	for(int i=1; i<=b; i++){
		s[i] += 50;
		for(int j=1; j<=50; j++)
			if(i != j) s[j]--;
	}
	
	cout << 50 << endl;
	for(int i=1; i<=50; i++)
		cout << s[i] + a << " \n"[i == 50];

	return 0;
}

Measured memory_bytes: 256
def examA():
    D,T,S = LI()
    if (D-1)//S<T:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
    return

def examB():
    S = SI()
    T = SI()
    s = len(S)
    t = len(T)
    ans = t
    for i in range(s-t+1):
        cnt = 0
        for j in range(t):
            if S[i+j]!=T[j]:
                cnt += 1
        ans = min(ans,cnt)

    print(ans)
    return

def examC():
    N = I()
    A = LI()
    S = sum(A)
    cnt = 0
    for a in A:
        cnt += (S-a)*a
        cnt %= mod
    ans = cnt * pow(2,mod-2,mod) % mod
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

int N, T, t[200000];

int main(){
  cin >> N >> T;
  for(int i = 0; i < N; i++){
    cin >> t[i];
  }
  int X = 0;
  for(int i = 0; i < N; i++){
    if(i + 1 < N){
      if(t[i + 1] - t[i] < T){
	X += t[i + 1] - t[i];
      }
      else{
	X += T;
      }
    }
    else{
      X += T;
    }
  }

  cout << X << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
signed main() {
    int A,B,X;cin>>A>>B>>X;
    int ans=INF;
    rep(i,22){
        int sum=0;
        sum+=A*i;
        int now=X-i*1000;
        if(now>0){
            sum+=B*((now+499)/500);
        }
        chmin(ans,sum);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3112
#include <iostream>
#include<math.h>

using namespace std;
int main(){
  int n,f;
  cin>>n;
  for(int i=0;i<8;i++){
    f+=(n%int(pow(10,(i+1))))/int(pow(10,i));
  }
  if(n%f==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  if (a * b % 2 == 0) cout << "Even" << endl;
  else cout << "Odd" << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>

int main(){
  
  int i;
  int r,d,x;
  
  scanf("%d %d %d",&r ,&d ,&x);
  //printf("%d %d %d\n",r ,d ,x);
  
  for(i = 0; i < 10; i++){
  
    x = r*x - d;
    printf("%d\n", x);
  
  }
  
  return 0;
  
}

Measured memory_bytes: 1700
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    int a, b; cin >> a >> b;
    cout << max(max(a+b, a-b), a*b) << endl;
    
    return 0;
}





Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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


	cin >> N >> K;
	vector<int>x(N);
	vector<int>y(N);
	vector<char>c(N);
	vector<vector<int>>black(K * 4, vector<int>(K * 4));
	vector<vector<int>>white(K * 4, vector<int>(K * 4));
	int all_b = 0, all_w = 0;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> c[i];
		x[i] %= (K * 2);
		y[i] %= (K * 2);
		if (c[i] == 'W') {
			white[x[i]][y[i]]++;
			white[x[i] + K * 2][y[i]]++;
			white[x[i]][y[i] + K * 2]++;
			white[x[i] + K * 2][y[i] + K * 2]++;
			all_w++;
		}
		else {
			black[x[i]][y[i]]++;
			black[x[i] + K * 2][y[i]]++;
			black[x[i]][y[i] + K * 2]++;
			black[x[i] + K * 2][y[i] + K * 2]++;
			all_b++;
		}
	}
	for (int i = 0; i < K * 4; i++) {
		for (int j = 1; j < K * 4; j++) {
			black[i][j] += black[i][j - 1];
			white[i][j] += white[i][j - 1];
		}
	}
	for (int i = 1; i < K * 4; i++) {
		for (int j = 0; j < K * 4; j++) {
			black[i][j] += black[i - 1][j];
			white[i][j] += white[i - 1][j];
		}
	}
	int ans = 0;
	for (int i = 1; i <= K * 2; i++) {
		for (int j = 1; j <= K * 2; j++) {
			int b = 0, w = 0;
			b += black[i + K * 2 - 1][j + K * 2 - 1];
			b -= black[i + K - 1][j + K * 2 - 1];
			b -= black[i + K * 2 - 1][j + K - 1];
			b += black[i + K - 1][j + K - 1];

			b += black[i + K - 1][j + K - 1];
			b -= black[i - 1][j + K - 1];
			b -= black[i + K - 1][j - 1];
			b += black[i - 1][j - 1];

			w += white[i + K - 1][j + K * 2 - 1];
			w -= white[i - 1][j + K * 2 - 1];
			w -= white[i + K - 1][j + K - 1];
			w += white[i - 1][j + K - 1];

			w += white[i + K * 2 - 1][j + K - 1];
			w -= white[i + K - 1][j + K - 1];
			w -= white[i + K * 2 - 1][j - 1];
			w += white[i + K - 1][j - 1];
			ans = max({ ans, b + w,(int)N - b - w });
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 126464
a11,a12,a13 = input().split()
a21,a22,a23 = input().split()
a31,a32,a33 = input().split()
lst = [a11,a12,a13,a21,a22,a23,a31,a32,a33]
bingo = []
n = int(input())
for i in range(n):
    ai = input()
    if ai in lst:
        bingo.append(lst.index(ai))
if 4 in bingo:
    if 0 in bingo:
        if 8 in bingo:
            print('Yes')
            exit()
    if 1 in bingo:
        if 7 in bingo:
            print('Yes')
            exit()
    if 2 in bingo:
        if 6 in bingo:
            print('Yes')
            exit()
    if 3 in bingo:
        if 5 in bingo:
            print('Yes')
            exit()
if 0 in bingo:
    if 1 in bingo:
        if 2 in bingo:
            print('Yes')
            exit()
    if 3 in bingo:
        if 6 in bingo: 
            print('Yes')
            exit()
if 8 in bingo:
    if 2 in bingo:
        if 5 in bingo:
            print('Yes')
            exit()
    if 6 in bingo:
        if 7 in bingo:           
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 3064
a=int(input())
list=[0,0,0,0,0]
for x in range(a):
	b=input()[:1]
	if 'M'==b:
		list[0]+=1
	elif 'A'==b:
		list[1]+=1
	elif 'R'==b:
		list[2]+=1
	elif 'C'==b:
		list[3]+=1
	elif 'H'==b:
		list[4]+=1
	a-=1
f=0
for c in range(5):
	for d in range(4):
		for e in range(3):
			if c<=d or c<=e or d<=e:
				break
			f+=list[c]*list[d]*list[e]
print(f)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define infinite 1000000000

int n, lista[200002], memo[200010][4];

int dp_par(int obj, int pulados){
	if(memo[obj][pulados]!=-1) return memo[obj][pulados];
	
	if(obj>n) return memo[obj][pulados]=0;
	if(pulados>=1) return memo[obj][pulados]=dp_par(obj+2, pulados)+lista[obj];
	
	int nao_pula=dp_par(obj+2, pulados)+lista[obj];
	int pula=dp_par(obj+1, pulados+1);
	return memo[obj][pulados]=max(nao_pula, pula);
}

int dp_impar(int obj, int pulados){
	if(memo[obj][pulados]!=-1) return memo[obj][pulados];
	
	if(obj==n and pulados==0) return memo[obj][pulados]=0;
	if(obj>n and pulados==0) return memo[obj][pulados]=-infinite;
	if(obj>n) return memo[obj][pulados]=0;
	if(pulados>=2) return memo[obj][pulados]=dp_impar(obj+2, pulados)+lista[obj];
	
	int nao_pula=dp_impar(obj+2, pulados)+lista[obj];
	int pula=dp_impar(obj+1, pulados+1);
	return memo[obj][pulados]=max(pula, nao_pula);
}

void solve(){
	cin >> n;
	for(int i=1; i<=n; i++) cin >> lista[i];
	for(int i=0; i<=n; i++) for(int j=0; j<4; j++) memo[i][j]=-1;
	if(n%2==0) cout << dp_par(1, 0);
	if(n%2==1) cout << dp_impar(1,0);
}

signed main(){
	solve();
}

Measured memory_bytes: 17652
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,x;
	cin>>a>>b;
	if((a+b)%2!=0)
		x=(a+b)/2+1;
	else
		x=(a+b)/2;
	cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K;
	ll A[200001];
	scan(N>>K);
	rep(i,N){
		scan(A[i]);
	}
	for(int i=K;i<N;i++){
		if(A[i]>A[i-K]){
			prin("Yes");
		}
		else prin("No");
	}
	return 0;
}


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

int main() {
  int n; cin >>n;
  int dai=0;
  int shou=INT_MAX;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    dai=max(dai,x);
    shou=min(shou,x);
  }
  cout<<dai-shou<<endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
string S,T;
cin>>S>>T;
if(S.at(0)==T.at(2)&&S.at(1)==T.at(1)&&S.at(2)==T.at(0)){
    cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}


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

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0) ;

    int x, y, z, k ;
    cin >> x >> y >> z >> k ;
    vector<long long> a(x), b(y), c(z) ;

    for (int i = 0; i < x; i++)
        cin >> a[i] ;
    for (int i = 0; i < y; i++)
        cin >> b[i] ;
    for (int i = 0; i < z; i++)
        cin >> c[i] ;

    vector<long long> ab ;

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

        for (int j = 0; j < y; j++) {

            ab.push_back(a[i] + b[j]) ;

        }

    }
    sort(c.rbegin(), c.rend()) ;
    sort(ab.rbegin(), ab.rend()) ;

    vector<long long> abc ;
    for (int i = 0; i < min(k, x*y); i++) {

        for (int j = 0; j < min(k, z); j++) {

            abc.push_back(ab[i] + c[j]) ;

        }

    }

    sort(abc.rbegin(), abc.rend()) ;
    for (int i = 0; i < k; i++) cout << abc[i] << endl ;
    return 0 ;

}


Measured memory_bytes: 42600
#include<cstdio>
long long sum(long long n,long long num)
{
	while(n%num!=0) n--;
	return (num*(1+n/num)*(n/num)/2);
}
long long summ(long long n)
{
	return ((1+n)*n/2);
}
int main()
{
	long long n;
	scanf("%lld",&n);
	printf("%lld",summ(n)-sum(n,3)-sum(n,5)+sum(n,15));
}

Measured memory_bytes: 1732
#include<deque>
#include<stdint.h>
#include<set>
#include<stack>
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<map>
using namespace std;
struct cc
{
	int x,y;
	bool operator < (cc z)const{return x<z.x;} 
}pos[200010];
int n,m,i,j,x1,yy,x2,y2,xs=1,ys=1,x,y,l,r,mid,res;
double s; 
vector<int> ans;
int main()
{
	ios::sync_with_stdio(false);
	cin>>x1>>yy>>x2>>y2>>n;
	if (x1>x2)
	{
		xs=-1;
	}
	if (yy>y2)
	{
		ys=-1;
	}
	x1*=xs;
	x2*=xs;
	yy*=ys;
	y2*=ys;
	for (i=1;i<=n;i++)
	{
		cin>>x>>y;
		x*=xs;
		y*=ys;
		if (x>=x1&&x<=x2&&y>=yy&&y<=y2)
		{
			pos[++m]={x,y};
		}
	}
	sort(pos+1,pos+m+1);
	for (i=1;i<=m;i++)
	{
		if (ans.empty()||ans.back()<pos[i].y) ans.push_back(pos[i].y);
		else *lower_bound(ans.begin(),ans.end(),pos[i].y)=pos[i].y;
	}
	//cout<<m<<' '<<ans.size()<<endl;
	if (ans.size()-1==min(x2-x1,y2-yy))
	{
		 s=10.0*acos(-1)-20;
		 ans.pop_back();
	}
	printf("%.15f",s+(y2-yy+x2-x1)*100.-(20-acos(-1)*5)*ans.size());
	return 0;
}

Measured memory_bytes: 2936
#include <stdio.h>
int main(){
  int i,j,N,minj,count=0;
  int temp;
  scanf("%d",&N);
  int A[N];
  
for(i=0;i<N;i++)
 scanf("%d",&A[i]);
 
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
    minj=j;
      }
    }
    temp=A[i];
    A[i]=A[minj];
    A[minj]=temp;
    if(A[i]!=A[minj])count++;
  }
 
 
  for(i=0;i<N-1;i++)printf("%d ",A[i]);
  printf("%d",A[N-1]);
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	string a;
	cin >> a;

	if (a[0] != a[1] && a[1] != a[2] && a[0] != a[2]) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;

	}

}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
	char c;
	if(getchar()=='7'){printf("Yes\n");return 0;}
	if(getchar()=='7'){printf("Yes\n");return 0;}
	if(getchar()=='7'){printf("Yes\n");return 0;}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 1456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, M, A, B;
	cin >> N >> M;
	vector<int> vec(N);
	bitset<100000> b;
  
  
  for(int i=0; i<N; i++){
	cin >> vec.at(i); 
  }
	for(int i=0; i<M; i++){
    	 cin >> A >> B;
      if(vec.at(A-1) > vec.at(B-1)){
      	b.set(B-1,1);
      }else if(vec.at(A-1) < vec.at(B-1)){
        b.set(A-1,1);
      }else{
        b.set(A-1,1);
      	b.set(B-1,1);
      }
    }
  
  cout << N - b.count() <<endl;
}

Measured memory_bytes: 3784
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int h[] = new int[n];
    int count = 0;
    for(int i = 0 ; i < n ; ++i){
      h[i] = sc.nextInt();
      if(h[i]>=k){
        count+=1;
      }
    }
    
    
    System.out.println(count);
    
  }
}



Measured memory_bytes: 59168
def solve(n,d):
    big = float('inf')
    small = float('-inf')
    for s in range(n - 2,-1,-1):
        row = [0,0,0]
        for j in range(3):
            i = s + 1
            if j == 0:
                row[j] = max(d[i][1],d[i][2]) + d[s][j]
            elif j == 1:
                row[j] = max(d[i][0],d[i][2]) + d[s][j]
            else:
                row[j] = max(d[i][1],d[i][0]) + d[s][j]
        d[s] = row

    return max(d[0])


def main():
    t = int(input())
    board = []
    for i in range(t):
        # n = int(input())
        d = input()
        d = [int(i) for i in d.split()]
        board.append(d)
    ans = solve(t,board)
    print(ans)
        
main()  

Measured memory_bytes: 24436
N, M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
P = list(map(int,input().split()))

ans = 0
# (0, 1, 2, ... 2^n-1) の部分集合の全探索（0を含むので合計2^n個)
# 例えば8なら、000〜111までの全部なので、スイッチの全パターンをなめる
for b in range(1<<N):  # 2**nでも一緒
    # 縦軸（M個の電球）→ スイッチ0の電球全部、スイッチ1の電球全部, ...
    for i in range(M):
        c = 0

        # スイッチ番号を順番に取得
        for s in src[i][1:]:
            # bにswitch_num番目のフラグがたってるか？
            # つまり、全探索のなかで、ビットがたってたら「処理をする」というだけ
            switch_num = s-1

            # どうせ全部なめるので、どっちでもいい
#            if b & (1<<(switch_num)):
            if (b >> switch_num) & 1 == 1:
                c += 1

        if c%2 != P[i]:
            break
    else:
        # 割り切れたらその電球は点いてるのでカウント対象
        ans += 1

print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 400005;
const int K = 26;
map < pair < int, int > , int > mp;
vector < pair < int, int > > col[N], r[N];
int n, dp[N][2], used[N][2];
int check(int x, int y){
    if (mp.find({x, y}) == mp.end()) return 2;
    return mp[{x, y}];
}
int binpow(int x, int y){
    if (y < 0) exit(0);
    if (y == 0) return 1;
    if (y % 2) return x * binpow(x, y - 1) % mod;
    int z = binpow(x, y / 2);
    return z * z % mod;
}
int solve(int d, int c){
   // cout << d << " " << c << endl;
    if (used[d][c]) return dp[d][c];
    if (check(d, d) == (c ^ 1)) return 0;
    if (d == n){
        return 1;
    }
    int res = 0;
    int cnt = 0;
    for (auto i: r[d]){
        int x = i.F;
        int y = x;
        int v = check(y, d);
        if (v != 2 && (i.S + v) % 2) return 0;
        if (v != 2) cnt++;
    }
    for (auto i: col[d]){
        int x = i.F;
        int y = x;
        int v = check(d, x);
        if (v != 2 && (i.S + v) % 2) return 0;
        if (v != 2) cnt++;
    }
    cnt /= 2;
    int z;
    if (d + 1 == n) z = 1; else
    z = binpow(2, (n - (d + 2)) - col[d].size() - r[d].size() + cnt);
    for (int i = 0; i < 2; i++){
        if (check(d, d + 1) == (i ^ 1)) continue;
        for (int j = 0; j < 2; j++){
        if (check(d + 1, d) == (j ^ 1)) continue;
            int x = (c + i + j) % 2;
            int f = 1;
            int v1 = check(d + 2, d);
            int v2 = check(d, d + 2);
            if (d + 1 == n){
                v1 = 2;
                v2 = 1;
            }
            if (v1 == 2 && v2 == 2) f = 2;
            else if (v1 == 2 || v2 == 2) f = 1;
            else if ((v1 + v2 + x) % 2 != 0) f = 0;
            else f = 1;
            res = (res + z * f % mod * solve(d + 1, x)) % mod;
        }
    }
    used[d][c] = 1;
    return dp[d][c] = res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int m;
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int x, y, z;
        cin >> x >> y >> z;
        if (x > y){
            if (x > y + 2) col[y].pb({x, z});
        }
        if (y > x){
            if (y > x + 2) r[x].pb({y, z});
        }
        mp[{x, y}] = z;
    }
    cout << (solve(1, 0) + solve(1, 1)) % mod;
}


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

int main(){
    ll x;
    cin >> x;
    if(x%11==0) cout << 2*x/11;
    else if(x%11<=6) cout << (x/11)*2+1;
    else cout << (x/11)*2+2;
    cout << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define INF (1<<29)
#define INFLL (1ll<<58)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int N,a[MAX+2];
int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    
    cin>>N;
    for(int i=1;i<=N;i++) cin>>a[i];
    
    int cunt=0;
    for(int i=1;i<=N;i++){
        if(i==a[a[i]]) cunt++;
    }
    
    cout<<cunt/2<<"\n";
    return 0;
}


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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 5;

int A[N], P[N], S[N];

int GCD(int a, int b) { return !b ? a : GCD(b, a % b); }

int main() {

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

	int n; cin >> n;
	for (int i = 1; i <= n; i++) cin >> A[i];
	for (int i = 1; i <= n; i++) P[i] = GCD(P[i - 1], A[i]);
	for (int i = n; i >= 1; i--) S[i] = GCD(S[i + 1], A[i]);
	int ans = 0;
	for (int i = 1; i <= n; i++) ans = max(ans, GCD(P[i - 1], S[i + 1]));
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1408
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, A, B;
    scan(N, A, B);
    long ans = MOD + powmod(2, N, MOD) - 1;
    ans %= MOD;
    auto f = new long[](B + 1);
    f[0] = 1;
    foreach (i; 1 .. B + 1)
        f[i] = (f[i - 1] * i) % MOD;

    long xa = 1;
    foreach (i; (N - A + 1) .. N + 1)
        xa *= i, xa %= MOD;

    long xb = 1;
    foreach (i; (N - B + 1) .. N + 1)
        xb *= i, xb %= MOD;

    auto ca = xa * invmod(f[A]) % MOD;
    auto cb = xb * invmod(f[B]) % MOD;
    writeln((ans + 2 * MOD - ca - cb) % MOD);

}

T powmod(T = long)(T x, T n, T m)
{
    if (n < 1)
        return 1;
    if (n & 1)
    {
        return x * powmod(x, n - 1, m) % m;
    }
    T tmp = powmod(x, n / 2, m);
    return tmp * tmp % m;
}

T invmod(T = long)(T x, T m = 10 ^^ 9 + 7)
{

    return powmod(x, m - 2, m);
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=[0]*N
    Mi=-1
    M=0
    for i in range(N):
        A[i]=I()
        if A[i]>M:
            Mi=i
            M=A[i]
            
    A[Mi]=0
    
    for i in range(N):
        if i!=Mi:
            print(M)
        else:
            print(max(A))

main()


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

using ll =long long;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b == 0){
       return(b);
   }else{
       return(gcd(b, a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a * b / gcd(a, b);
}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//



int main(){
cout<<fixed<<setprecision(10);
  
int A,B;
  cin>>A>>B;
  if(A%2==0||B%2==0){
    cout<<"No"<<endl;}
  else{cout<<"Yes"<<endl;}


  



}


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

int main()
{
  int q, c, a, n, r;

  cin >> q;
  for (int i = 0; i < q; i++){
    r = 0;
    cin >> c >> a >> n;

    while (c >= 1 && a >= 1 && n >= 1){
      r++;
      c--;
      a--;
      n--;
    }

    while (c >= 2 && a >= 1){
      r++;
      c -= 2;
      a--;
    }

    while (c >= 3){
      r++;
      c -= 3;
    }

    cout << r << "\n";
  }

  return (0);
}

Measured memory_bytes: 1164
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

for i in range(N):
    if h[i] > 0:
        xx = x[i]
        yy = y[i]
        hh = h[i]

for cx in range(101):
    for cy in range(101):
        H = hh + abs(xx - cx) + abs(yy - cy)
        ok = True
        for i in range(N):
            if h[i] != max(H-abs(x[i] - cx) - abs(y[i] - cy), 0):
                ok = False
        if ok:
            print(cx, cy, H)



Measured memory_bytes: 44400
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        String inStr = input.nextLine();
        char A = inStr.charAt(0);
        char B = inStr.charAt(1);
        char C = inStr.charAt(2);
        char D = inStr.charAt(3);
        if((A == B && B == C) || (B == C && C == D)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");           
        }
    }
}

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

int main(){

  long long A,B,N;
  cin >> A >> B >> N;

  long long ans=0;

  long long x = B-1;
  while(1){
    if(x<=N) break;
    x--;
  }
  long long num1 = (A*x/B);
  long long num2 = (x/B);
  ans = num1-A*num2;

  cout << ans << endl;
}

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

using namespace std;

int main(){

   int n;
   string s;
   int ac = 0, wa = 0, tle = 0, re = 0;

   cin >> n;

   for(int i = 0; i < n; i++){
      cin >> s;

      if(s == "AC"){
         ac++;
      }
      else if(s == "WA"){
         wa++;
      }
      else if(s == "TLE"){
         tle++;
      }
      else{
         re++;
      }
   }

   cout << "AC x " << ac << endl;
   cout << "WA x " << wa << endl;
   cout << "TLE x " << tle << endl;
   cout << "RE x " << re << endl;

   return 0;
}

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

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

  vector<int> forb(k);
  for (auto &i : forb) {
    cin >> i;
  }

  while (true) {
    string cur = to_string(n);
    bool can = true;
    for (auto &c : cur) {
      for (auto &f : forb) {
        if (c - '0' == f) {
          can = false;
        }
      }
    }
    if (can) {
      cout << n << "\n";
      return 0;
    }
    n++;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N, K;
  cin >> N;
  cin >> K;

  string s;
  cin >> s;

  int h[100000]; // human

  for(int i=0; i<N; i++){
    if (s[i] == 'L') {
      h[i] = 1;
    }
    else if (s[i] == 'R') {
      h[i] = -1;
    }
    else {
      cout << 111;
    }
  }

  int happy = 0;
  int diff = 0;
  for(int i=0; i<N-1; i++){
    if (h[i] == h[i+1]) {
      happy++;
    }
    else {
      diff++;
    }
  }

  diff = min(diff, 2*K);

  cout << happy + diff << endl;

  return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;
public class Main {
	public static void main(String[]args) {
		
		Scanner sc = new Scanner(System.in);
		int N = 0,A = 0,B = 0,x = 0;
		
		N = sc.nextInt();
		A = sc.nextInt();
		B = sc.nextInt();
		x = N * A;
		
		if(x <= B) {
			System.out.print(x);
		}else {
			System.out.println(B);
		}
	}
}


Measured memory_bytes: 23636
from collections import deque

N, M = map(int, input().split())
neib = {i+1:[] for i in range(N)}
for i in range(M):
  a, b = map(int, input().split())
  neib[a].append(b)
  neib[b].append(a)
#print(neib)
mitishil = {i+1:-1 for i in range(1,N)}
#print(mitishil)

q = deque()
q.append(1)
while(q):
  v = q.popleft()
  ls = neib[v]
  #print(v,ls)
  for l in ls:
    #print(l)
    if (l == 1): continue
    if (mitishil[l] == -1):
      mitishil[l] = v
      q.append(l)
    #print(mitishil)
print("Yes")
for i in mitishil.values():
  print(i)





Measured memory_bytes: 53964
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (true) {
            int a = input.nextInt();
            String op = input.next();
            char c = op.charAt(0);
            int b = input.nextInt();
            if (c == '?') break;
            int ret = 0;
            if (c == '+') ret = a + b;
            else if (c == '-') ret = a - b;
            else if (c == '*') ret = a * b;
            else if (c == '/') ret = a / b;
            System.out.println(ret);
        }
    }
}

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

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

  cin >> a >> b >> c;

  if ((a == b && a != c) || (b == c && b != a) || (c == a && c != b))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
s=input()
t=input()
ds=dict()
dt=dict()
ss=''
st=''
for i in s:
    if i not in ds:
        ds[i]=str(len(ds))+' '
    ss+=ds[i]
for i in t:
    if i not in dt:
        dt[i]=str(len(dt))+' '
    st+=dt[i]
#print(ss,st)
print('Yes' if ss==st else 'No')
#print(ds,dt)

Measured memory_bytes: 10372
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
ll dp[1001][10010];
int w[1001],s[1001];
ll v[1001];
int N;
int main(){
	cin>>N;
	rep(i,N) cin>>w[i]>>s[i]>>v[i];
	rep(i,N-1) rep(j,N-1) if(w[j]+s[j]>w[j+1]+s[j+1]){
		swap(w[j],w[j+1]);
		swap(s[j],s[j+1]);
		swap(v[j],v[j+1]);
	}
	ll ans = 0;
	rep(i,N) rep(j,10001){
		if(j<=s[i]){
			if(j+w[i]<=10000) chmax(dp[i+1][j+w[i]],dp[i][j]+v[i]);
		chmax(ans,dp[i][j]+v[i]);
		}
			chmax(dp[i+1][j],dp[i][j]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 78464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;cin>>N;
    ll sum=0;
    for(int i=0;i<N;i++){
        ll a;cin>>a;
        sum+=a;
    }
    cout<<sum-N*(N+1)/2<<endl;
}





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

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        PrintWriter cout = new PrintWriter(System.out);

        int n = cin.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = cin.nextInt() - 1;
        int[] b = new int[n];
        for(int i=0;i<n;i++) b[i] = cin.nextInt();
        int[] c = new int[n];
        for(int i=1;i<n;i++) c[i] = cin.nextInt();

        int tot = 0;
        int last = -1;
        for(int i=0;i<n;i++) {
            tot += b[a[i]];
            if(last + 1 == a[i]) tot += c[a[i]];
            last = a[i];
            //cout.println("tot: " + tot);
        }
        cout.println(tot);
        cout.close();
    }
}


Measured memory_bytes: 23636
n=int(input())
if n==1:
    print(0)
else:
    pf={}
    m=n
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    ans=[]
    m=0
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            m=n//i-1
            if n%m==i and n//m==i:
                ans.append(m)

    #print(int(n**0.5))
    print(sum(ans))

Measured memory_bytes: 40044