akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
    int H, W;
    char S[2100][2100];
    int saveW[2100];
    int saveH = 0;
    int i,k,j;
    int max = 0;

    scanf("%d %d", &H, &W);
    for(i=0; i<H; i++){
        scanf("%s", &S[i]);
    }
    for(i=0; i<W; i++){
        saveW[i] = 0;
    }

    for(i=0; i<H; i++){
        saveH = 0;
        for(j=0; j<W; j++){
            if(S[i][j] == '#'){
                saveH = 0;
                saveW[j] = 0;
            }
            if(saveH == 0 && S[i][j] == '.'){
                saveH = 1;
                for(k=j+1; k<W; k++){
                    if(S[i][k] == '.'){
                        saveH += 1;
                    }else{
                        break;
                    }
                }
            }
            if(saveW[j] == 0 && S[i][j] == '.'){
                saveW[j] = 1;
                for(k=i+1; k<H; k++){
                    if(S[k][j] == '.'){
                        saveW[j] += 1;
                    }else{
                        break;
                    }
                }
            }
            if(max< saveH + saveW[j]){
                max = saveH+saveW[j];
            }
            //printf("%d %d %d %d\n", i,j,saveH, saveW[j]);
        }
    }

    printf("%d", max-1);

    return 0;
}

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

int main() {
	int n,l;cin>>n>>l;
	vector<string> s(n);
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	string temp;
	for(int i=0;i<n;i++){
		for(int j=0;j<n-1;j++){
			string s1=s[j];
			string s2=s[j+1];
			for(int k=0;k<l;k++){
				if(s1[k]>s2[k]){
					s[j]=s2;
					s[j+1]=s1;
				}
				if(s1[k]<s2[k])break;
			}
		}
	}
	for(int i=0;i<n;i++){
		cout<<s[i];
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<bits/stdc++.h>
using namespace std;
 
int coin[17];
int ans;
 
void solve(int n, int u){
 
    for (int i = u; i >= 0; i--){
        if (n > coin[i]) solve(n - coin[i], i);
        else if (n == coin[i]) ans++;
    }
 
    return;
}
 
 
int main(void){
 
    int n;

    for (int i = 0; i < 17; i++){
        coin[i] = (i + 1) * (i + 1);
    }
 
    while (cin >> n, n){
        ans = 0;
        solve(n, 16);
        cout << ans << endl;
    }
 
    return 0;
}

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

constexpr int64_t INF = static_cast<int64_t>(1) << 60;

int main()
{
	int64_t A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;

	int64_t min_price = INF;
	for (int64_t i = 0; i/2 <= max(X, Y); i += 2)
	{
		int64_t price = C * i + A * max(X - i/2, static_cast<int64_t>(0)) + B * max(Y - i/2, static_cast<int64_t>(0));
		min_price = min(min_price, price);
	}

	cout << min_price << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, l, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
#define sort(v) sort(v.begin(), v.end())
#define sortr(v) sort(v.rbegin(), v.rend())
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int h, w;
    cin >> h >> w;
    if(h > w) cout << "safe";
    else cout << "unsafe";
}

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

using namespace std;

int main()
{
    int N;
    string S;

    cin >> N;
    cin >> S;

    int whiteCount = 0;
    int blackCount = 0;

    for (int i = 0; i < N; i++)
    {  
         if (S[i] == '#')
         {
             blackCount++;
         }
         else if (S[i] == '.')
         {
             whiteCount++;
         }
    }

    int minCount = INT32_MAX;
    int currentWhiteCount = whiteCount;
    int currentBlackCount = 0;

    for (int i = 0; i < N + 1; i++)
    {      
        minCount = min(minCount, (currentWhiteCount + currentBlackCount));

        if (i == N)
            break;

         if (S[i] == '#')
         {
             currentBlackCount++;
         }
         else if (S[i] == '.')
         {
             currentWhiteCount--;
         }   
    }

    cout << minCount << endl;

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
	int f=1,x=0; char c=getchar();
	while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
	return f*x;
}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b>=c)cout<<"Yes"<<endl;else cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
#define ll long long


int main() {
	int n, h[100010];
	bool flag = false;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	for (int i = 1; i < n; i++) {
		if (h[i] > h[i - 1])h[i]--;
		if (h[i] < h[i - 1]) {
			flag = true;
			break;
		}
	}
	if (flag)cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
while True:
    H,W=map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j)%2 == 0:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()    


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqS = new string[n];
        for (int i = 0; i < seqS.Length; ++i)
        {
            seqS[i] = Console.ReadLine().Trim();
        }

        var bag = new Dictionary<string, int>();
        var bucket = new int['z' - 'a' + 1];
        for (int i = 0; i < seqS.Length; ++i)
        {
            Array.Clear(bucket, 0, bucket.Length);
            for (int j = 0; j < seqS[i].Length; j++)
            {
                ++bucket[seqS[i][j] - 'a'];
            }
            var s = string.Join("", bucket.Select((x, c) => new string((char)(c + 'a'), x)));
            if (bag.ContainsKey(s))
            {
                ++bag[s];
                continue;
            }
            bag[s] = 1;
        }

        var k = bag.Sum(x => (1L + (x.Value - 1)) * (x.Value - 1) / 2);
        Console.WriteLine(k);
    }
}


Measured memory_bytes: 34628
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq

logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n,m = map(int,input().split())
	a = list(map(int,input().split()))
	priority = PriorityQueue()
	for i in a:
		priority.push(i)
	for _ in range(m):
		mx = priority.pop()
		priority.push(mx//2)
	print(priority.sum())

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()


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

#define MOD 1046527
#define L 20
char dict[MOD][L];

char get_num(char c){
  switch(c){
    case 'A':
      return 1;

    case 'C':
      return 2;

    case 'G':
      return 3;

    case 'T':
      return 4;

    default:
      return 0;
  }
}

int get_h1(int key){
  return key % MOD;
}

int get_h2(int key){
  return 1 + (key % (MOD - 1));
}

int get_key(char* str){
  int key = 0;
  int p = 1;
  while(*str){
    key += get_num(*str++) * p;
    p *= 5;
  }
  return key;
}

bool search(char str[]){
  int key = get_key(str);
  int h1 = get_h1(key);
  int h2 = get_h2(key);
  int hash = h1;
  while(true){
    if(dict[hash][0]==0){
      return false;
    }
    else if(strcmp(dict[hash],str)==0){
      return true;
    }
    hash = (hash + h2) % MOD;
  }
}

void insert(char str[]){
  int key = get_key(str);
  int h1 = get_h1(key);
  int h2 = get_h2(key);
  int hash = h1;
  while(true){
    if(dict[hash][0]==0){
      strcpy(dict[hash], str);
      break;
    }
    hash = (hash + h2) % MOD;
  }
}

int main(){
  char com[L];
  char str[L];
  int n;
  scanf("%d",&n);

  for(int itr=0; itr<n; itr++){
    scanf("%s %s",com,str);
    int key = get_key(str);
    if(com[0] == 'i'){
      insert(str);
    }
    else{
      if(search(str)){
        printf("yes\n");
      }
      else{
        printf("no\n");
      }
    }
  }

  return 0;
}



Measured memory_bytes: 23588
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s;
  cnt = 1;
  rep(i, Size(s)) {
    if (s[i] == s[i + 1])
      cnt++;
    else {
      ans = max(ans, cnt);
      cnt = 1;
    }
  }
  ans = max(ans, cnt);
  if (ans >= 3)
    Cout("Yes");
  else
    Cout("No");
  return 0;
}

Measured memory_bytes: 764
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = b[a[0] - 1]
for i in range(1, n):
    ans += b[a[i] - 1]
    if a[i] - a[i - 1] == 1:
        ans += c[a[i] - 2]
print(ans)


Measured memory_bytes: 3064
#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"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    ll r = 0, w = 0;
    string s;
    cin >> s;
    rep(0, i, N)
    {
        if (s.at(i) == 'R')
        {
            r++;
        }
        else
        {
            w++;
        }
    }

    if (r == 0 || w == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    rep(0, i, r)
    {
        if (s.at(i) == 'W')
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main() {
    int k, x;
    cin >> k >> x;
    for (int i = x - k + 1; i <= x + k -1; i++) {
        if (i < x + k - 1) {
            cout << i << " ";
        } else {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// Problem : A - Grouping
// Contest : AtCoder - AtCoder Beginner Contest 062
// URL : https://atcoder.jp/contests/abc062/tasks/abc062_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int arr[13]={0};
arr[1]=arr[3]=arr[5]=arr[7]=arr[8]=arr[10]=arr[12]=1;
arr[4]=arr[6]=arr[9]=arr[11]=2;
arr[2]=3;
int n,m;
cin>>n>>m;
if(arr[n]==arr[m])
{
	cout<<"Yes";
}
else
cout<<"No";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 256
# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]

# n = int(input())
# N, K = map(int, input().split())
S = input()

first = int(S[0]) * 10 + int(S[1])
second = int(S[2]) * 10 + int(S[3])
MMYY = False
YYMM = False

if first >= 1 and first <= 12:
    if second >= 0 and second <= 99:
        MMYY = True

if second >= 1 and second <= 12:
    if first >= 0 and first <= 99:
        YYMM = True

if MMYY and YYMM:
    print("AMBIGUOUS")
elif MMYY:
    print("MMYY")
elif YYMM:
    print("YYMM")
else:
    print("NA")




















Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#define fcout(n) cout<<fixed<<setprecision((n))
using namespace std;
int main(){
	int a,b,c,t=0;
	cin>>a>>b>>c;
	while(1){
		if(t>10000007){
			t=-1;
			break;
		}
		if((c+60*t)%(a+b)<=a){
			break;
		}
		else t++;
	}
	if(t==-1) cout<<-1<<endl;
	else cout<<60*t+c<<endl;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; print(tail...); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	ll n, m; read(n, m);
	string s, t; read(s, t);

	ll len = n * m / __gcd(n, m);
	
	map<ll, char> mp;
	rep(i, 0, n) mp[i * len / n] = s[i];
	rep(i, 0, m) {
		if (mp.find(i * len / m) != mp.end() && mp[i * len / m] != t[i]) {
			write(-1);
			return 0;
		}
	}

	write(len);
}


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

using namespace std;

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

	int ans = 0;

	for (int i = 1; i <= n; i++)
	{
		if (i <= k)ans += x;
		else ans += y;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);

 int main(){
   ll L, R, ans=2019;
   cin >> L >> R;
   if(L%2019>=R%2019 || R - L >= 2018)
     ans = 0;
   else for(int i=L; i<=R; i++){
     for(int j=i+1; j<=R; j++){
       if(ans > ((i%2019)*(j%2019))%2019)
         ans = (i%2019)*(j%2019)%2019;
     }
   }
   cout << ans << endl;
 }
     

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

using namespace std;
typedef long long ll;
const int N = 1e9 + 1;
int mod = 1e9 + 7;
#define INF 0x3f3f3f3f
typedef pair<int, int> pii;

int main()
{
#ifndef ONLINE_JUDGE  
    //freopen("in.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif 
   // ios::sync_with_stdio(0);
    int n, m;
    while (~scanf("%d%d", &n, &m))
    {
    	int ans = 0;

    	int mid = (int)sqrt(m) + 1;
    	for (int i = 1; i <= mid; i++)
    	{
    		if (m % i == 0)
    		{
    			int t = m/i;
    			if (t >= n)
    			{
    				ans = max(ans, i);
    			}

    			if (i >= n)
    			{
    				ans = max(ans, t);
    			}
    		}
    	}

    	printf("%d\n", ans);
    }
    return 0;
}

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

template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

using mint = ModInt<1000000007>;

mint dp[55][55][55 * 55];
/*
ボール 1, 2, 3, ..., nを箱1, 2, 3, ..., nに入れていくことを考える。
ボールは、保留するか箱に入れるか
dp[i][j][k]: 箱iまでみたときに、保留がj個あって、奇妙さがkになっているもの
*/

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

    int n, K;
    cin >> n >> K;
    dp[0][0][0] = 1;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k <= K; k++) {
                dp[i + 1][j][j * 2 + k] += dp[i][j][k] * (2 * j + 1);
                if (j > 0) dp[i + 1][j - 1][j * 2 + k] += dp[i][j][k] * (j * j);
                dp[i + 1][j + 1][j * 2 + k] += dp[i][j][k];
            }
        }
    }

    cout << dp[n][0][K] << endl;
}


Measured memory_bytes: 36096
package main

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

func main() {
	run()
}

func run() {
	setSpace()

	m, n := readN(), readN()

	if m == n {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

// ------以下、ユーティリティ------

var sc = bufio.NewScanner(os.Stdin)

func setSpace() {
	sc.Split(bufio.ScanWords)
}

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

func readN() int {
	n, err := strconv.Atoi(read())
	if err != nil {
		panic(err)
	}
	return n
}


Measured memory_bytes: 640
from fractions import gcd
import numpy as np

n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))

pre = a[0]
for v in a[1:]:
    pre = pre * v // gcd(pre, v)

for v in a:
    if (pre // 2 - (v // 2)) % v:
        print(0)
        break
else:
    print((m + pre//2) // pre)


Measured memory_bytes: 24120
c = input().rstrip('\n')

str1 = "eraser"
str2 = "erase"
str3 = "dreamer"
str4 = "dream"



c = c.replace(str1, "")
c = c.replace(str2, "")
c = c.replace(str3, "")
c = c.replace(str4, "")

if (c == ""):
  print("YES")
else:
  print("NO")


Measured memory_bytes: 3188
s=input()
t=input()
ans=[]
for i in range(len(s)-len(t)+1):
  start=i
  end=i+len(t)
  ok=True
  for j in range(len(t)):
    if s[start+j]!='?' and s[start+j]!=t[j]:
      ok=False
      break
  if ok:
    a=s[:start]+t+s[end:]
    ans.append(a.replace('?','a'))
if ans:
  ans=sorted(ans)
  print(ans[0])
else:
  print('UNRESTORABLE')


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

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

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

	sort(a.begin(), a.end());

	vector<pair<ll, ll>> v(n - 1);
	rep(i, n - 1) v[i] = make_pair(abs((a.back() + 1) / 2 - a[i]), a[i]);
	sort(v.begin(), v.end());

	printf("%lld %lld\n", a.back(), v.front().second);
}

Measured memory_bytes: 2560
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(43);

int n;
pair <ll, ll> p[200000];

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("rps2.in", "r", stdin);
	//freopen("rps2.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> p[i].second >> p[i].first;
	sort(p, p + n);
	ll res = 0;
	for (int i = 0; i < n; i++)
	{
		res += p[i].second;
		if (res > p[i].first)
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
int main()
{
    int n,s=0,maxs=0,a[3][105];
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[1][i];
   	for(int i=0;i<n;i++)
    	cin>>a[2][i];
   	for(int i=0;i<n;i++)
   	{
	   	s+=a[1][i];
	   	int t=s;
	    for(int j=i;j<n;j++)
	   	{
	   		t+=a[2][j];
	   	}
	   	maxs=max(maxs,t);
	}
    cout<<maxs<<endl;
    return 0;
}

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

using namespace std;

int main(void) {
	string s;
	int K;
	cin >> s;
	cin >> K;
	for(int i = 0; i < s.length(); ++i) {
		if(i != s.length() - 1) {
			if(s[i] != 'a' && 26 - (s[i] - 'a') <= K) {
				K -= 26 - (s[i] - 'a');
				s[i] = 'a';
			}
		} else {
			s[i] = 'a' + (((s[i] - 'a') + K) % 26);
		}
	}
	cout << s << '\n';
	return 0;
}



Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
					
public class Program
{
	public static void Main()
	{
		//int n = int.Parse(Console.ReadLine());
		long[] arr = Console.ReadLine().Split().Select(e => long.Parse(e)).ToArray();
		
		List<long> l = arr.ToList();
		l.Sort();
		
		long a = l[0];
		long b = l[1];
		long c = l[2];
		
		int even = 0;
		foreach(var v in l)
		{
			if(v%2 == 0)
			{
				even = 1;
				break;
			}
		}
		
		long res = 0;
		if(even != 1)
		{
			res = a*b;
		}
		Console.WriteLine(res);
	}
	
}

Measured memory_bytes: 3288
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,q,a[101010],s[101010];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout); 
	cin>>n;
	ll ans=0;
	fo(i,0,n){
		cin>>a[i];
		s[a[i]]++;
		ans+=a[i];
	}
	cin>>q;
	while(q--){
		int b,c;
		cin>>b>>c;
		ans+=(ll)(c-b)*s[b];
		s[c]+=s[b];
		s[b]=0;
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 4404
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	int i;
	int j;
	int k;
	int count=0;
	Scanner scan = new Scanner(System.in);

	int snum = scan.nextInt();
	int S[] = new int[snum];
	for(i=0 ; i<snum ; i++){
	    S[i] = scan.nextInt();
	}

	int tnum = scan.nextInt();
	int T[] = new int[tnum];
	for(j=0 ; j<tnum ; j++){
	    T[j] = scan.nextInt();
	}
	
	for(j=0 ; j<tnum ; j++){
	    for(i=0 ; i<snum ; i++){
		for(k=i-1 ; k>0 ; k--){
		    if(S[i] == S[k]){
			i++;
			break;
		    }
		}
		if(T[j] == S[i]){
		    count++;
		    break;
		}
	    }
	}
	System.out.println(count);
    } 
}




Measured memory_bytes: 42756
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	string s="CODEFESTIVAL2016";
	string t;
	int ans=0;
	cin>>t;
	for(int i=0;i<s.size();i++){
		if(t[i]!=s[i]){
			t[i]=s[i];
			ans++;
		}
	}
	cout<<ans<<endl;
}


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

x, a, b = map(int, input().split())

# x日まで過ぎてもOK
# a日前に買ってくる
# b日後に食べた

if (a - b) >= 0 :
    print('delicious')
elif (a + x) - b >= 0:
    print('safe')
else:
    print('dangerous')


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


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

	string s;
	cin >>s;
	
	cout <<s.substr(0,3) <<"\n";
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
using namespace std;
int x[13][32], y[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 }, sum, n, m; string T[7] = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
int main() {
	sum = 4;
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= y[i]; j++) {
			x[i][j] = sum % 7;
			sum++;
		}
	}
	while (true) {
		cin >> n >> m; if (!n) { break; }
		cout << T[x[n][m]] << endl;
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> L(n+1), R(n+1);
  rep(i,n){
    L[i+1] = L[i] + a[i];
    R[i+1] = R[i] + a[n-i-1];
  }
  ll minn = 2000000000;
  for(int i=1; i<n; i++){
    minn = min(minn, abs(L[i] - R[n-i]));
  }
  cout << minn << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <complex>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
const double PI = acos(-1);
inline bool equals(double a, double b) { return abs(b - a) < EPS; }
using Point = complex<double>;
namespace std { bool operator < (const Point &a, const Point &b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); } }
struct Line
{
    Point a, b;
    Line(Point a, Point b) : a(a), b(b) {}
};
double dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }
double cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
bool isParallel(const Line &a, const Line &b) { return equals(cross(a.b - a.a, b.b - b.a), 0.0); }
bool isOrthogonal(const Line &a, const Line &b) { return equals(dot(a.a - a.b, b.a - b.b), 0.0); }
Point projection(const Line &l, const Point &p)
{
    double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(8);
    double x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    int q; cin >> q;
    Line l = Line(Point(x1, y1), Point(x2, y2));
    while(q--)
    {
        double x, y; cin >> x >> y;
        Point res = reflection(l, Point(x, y));
        cout << res.real() << " " << res.imag() << endl;
    }
    return 0;
}


Measured memory_bytes: 3372
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int nCount, iIn, iAlice = 0, iBob = 0;
	vector<int> arrNums;
	register int i;
	cin >> nCount;
	for (i = 1; i <= nCount; ++i){
		cin >> iIn;
		arrNums.push_back(iIn);
	}
	sort(arrNums.begin(), arrNums.end(), isgreaterequal<int,int>);
	for (i = 0; i < nCount; ++i){
		if (i % 2 == 0)
			iAlice += arrNums[i];
		else
			iBob += arrNums[i];
	}
	cout << iAlice - iBob;
	return 0;
}

Measured memory_bytes: 256
<?php
	$n = intval(fgets(STDIN)) - 1;
	$val = explode(" ",str_replace("\n","",fgets(STDIN)));
 
	for($i = $n;$i >= 0;$i -= 2){
		echo $val[$i]." ";
	}
    
	for($j = abs($i + 1);$j <= $n;$j += 2){
		echo $val[$j]." ";
	}
?>

Measured memory_bytes: 25204
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;

void process(string &s ,int *pref,int *pres,int n){
    for(int x=1;x<n;x++)
        if(s[x] == 'C' and s[x-1] == 'A') pref[x+1] = 1,pres[x+1] = 1;

    for(int x=1;x<=n;x++)    pref[x] += pref[x-1];

}

int32_t main(){
    FAST;
    int n,q;    cin >> n >> q;
    string s;   cin >> s;
    int pref[n+1] = {0},pres[n+1] = {0};
    process(s,pref,pres,n);
    while(q--){
        int l , r;  cin >> l >> r;  // 1-based
        int ans = pref[r] - pref[l-1];
        if(pres[l] == 1) ans = max(0LL , ans-1);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 2640
#include <stdio.h>
#include <string.h>

void judge(int *dice, char *str);
void swap_dice(int *dice, int a, int s, int d, int f);

int main(void)
{
	int n = 1;
	int i;
	int sum = 1;
	int dice[6] = {1, 2, 3, 4, 5, 6};
	char str[10];
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%s", str);
			judge(dice, str);
			sum += dice[0];
		}
		
		printf("%d\n", sum);
		sum = 1;
		
		for (i = 0; i < 6; i++){
			dice[i] = i + 1;
		}
	}
	return (0);
}
void judge(int *dice, char *str)
{
	char dice_command[6][6] = {"North", "East", 
						"West", "South", "Right", "Left"};
	int i;
	
	for (i = 0; i < 6; i++){
		if (strcmp(dice_command[i], str) == 0){
			break;
		}
	}
	//North
	if (i == 0){
		swap_dice(dice, 4, 0, 1, 5);
	}
	//East
	else if (i == 1){
		swap_dice(dice, 2, 0, 3, 5);
	}
	// West
	else if (i == 2){
		swap_dice(dice, 3, 0, 2, 5);
	}
	//South
	else if (i == 3){
		swap_dice(dice, 1, 0, 4, 5);
	}
	//Right
	else if(i == 4){
		swap_dice(dice, 3, 1, 2, 4);
	}
	//Left
	else {
		swap_dice(dice, 2, 1, 3, 4);
	}
}

void swap_dice(int *dice, int a, int s, int d, int f)
{
	int tmp;
	
	tmp = dice[a];
	dice[a] = dice[s];
	dice[s] = dice[d];
	dice[d] = dice[f];
	dice[f] = tmp;
}

Measured memory_bytes: 612
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
const int maxn=1456;
bool sieve[maxn];
int sp[maxn];
void prmgen2()
{
    fill(sieve+2,sieve+maxn, 1);
	int len=sqrt(maxn)+1;
	for(int i=2;i<=len;i++)
		if(sieve[i])
		{
			sp[i]=i;
			for(int j=i*i;j<maxn;j+=i)
				if(sp[j]==0)
				{
					sieve[j]=0;
					sp[j]=i;
				}
		}
	for(int i=len+1;i<maxn;i++)
		if(sieve[i])
			sp[i]=i;
}
int arr[1000];
int main()
{
    prmgen2();
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i<= n; i+=2){
        fill(arr, arr + i+1, 0);
        int temp = i;
        while(temp>1){
            arr[sp[temp]]++;
            temp/=sp[temp];
        }
        temp = 1;
        for (int j = 1; j*j <= i; j++){
            temp *= (arr[j] +1);
        }
        if (temp == 8)
            cnt++;
    }
    cout << cnt;
	return 0;
}	


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int N = 0;
    if(b<10){
      N=10*a+b;
    }else if(10<=b&&b<100){
      N=100*a+b;
    }else{
      N=1000*a+b;
    }
  //  System.out.println(N);
    System.out.println(isSq(N));
    
  }
  
  //引数が平方数なら"Yes",違うなら"No"を返すメソッド
  public static String isSq(int N){
   String res = "No";
    for(int i=1;i<=(int)Math.ceil(Math.sqrt(N));i++){
             // System.out.println(i);
      if(i*i==N){
        //System.out.println(i);
        res="Yes";
        return res;
      }
    }
    return res;
        
    
  }
    
  

  
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll quick_pow(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b & 1) ans *= a;
        a *= a;
        b >>= 1;
    }
    return ans;
}

int main(void) {
    int n, p;
    while(~scanf("%d%d", &n, &p)) {
        bool flag = 0;
        int cnt1 = 0, cnt2 = 0;
        for(int i = 0; i < n; ++i) {
            int x; scanf("%d", &x);
            if(x & 1) cnt1++;
            else cnt2++;
        }
        if(p) {
            if(cnt1) printf("%lld\n", quick_pow(2, n - 1));
            else puts("0");
        } else {
            printf("%lld\n", cnt1 ? quick_pow(2, n - 1) : quick_pow(2, n));
        }
    }
}


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

typedef long long LL;

#define int LL

signed main() {
    int T; scanf("%d", &T);
    while (T--) {
        int A, B, C, D; scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
        int len = (max(A, B) + min(A, B)) / (min(A, B) + 1);
        int l = 0, r = 1e9, mid, pos = -1;
        while (l <= r) {
            mid = (l + r) >> 1;
            int t1 = A - mid / (len + 1) * len - mid % (len + 1);
            int t2 = B - mid / (len + 1);
            int h1 = t1 * len + (mid % (len + 1) || !mid ? len : len - 1);
            if (t1 >= 0 && t2 >= 0 && h1 >= t2) pos = mid, l = mid + 1;
            else r = mid - 1;
        } 
        assert(pos >= 0);
        for (int i = C; i <= min(D, pos); i++) 
            putchar(i % (len + 1) ? 'A' : 'B');
        for (int i = min(D, max(pos, C - 1)) + 1; i <= D; i++) 
            putchar((A + B - i + 1) % (len + 1) ? 'B' : 'A');
        puts("");
    }
    return 0;
}


Measured memory_bytes: 384
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 1024;

int main(void) {
//	in = fopen("A.in", "rt");
	
	int n;
	fscanf(in, "%d", &n);
	fprintf(out, "%d\n", (n - 2) * 180);
	
	return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    # h0,w0h1,w1 = map(int, input().split())
    n=int(input())
    taro=hanako=0
    for _ in range(n):
        tw,hw=input().split()
        if tw>hw:
            taro+=3
        elif tw==hw:
            taro+=1
            hanako+=1
        else:
            hanako+=3
    print(taro,hanako)

main()



Measured memory_bytes: 5608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc  =new Scanner(System.in);
		String string = sc.next();

		if(Character.isUpperCase(string.charAt(0))) {
			System.out.println("A");
		}else {
			System.out.println("a");
		}

		sc.close();

	}

}


Measured memory_bytes: 35776
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

int main() {
	int n, m;
	cin >> n >> m;
	hei(llint) a(n);
	rep(i, 0, n)cin >> a[i];
	vector<pair<llint,llint>> s(m);
	sort(a.begin(), a.end());
	rep(i, 0, m) {
		cin >> s[i].second >> s[i].first;
	}
	sort(s.begin(), s.end());
	int x = m - 1;
	llint ans = 0;
	rep(i, 0, n) {
		if (s[x].second == 0)x--;
		if (x == -1)goto Z;
		if (a[i] < s[x].first) {
			ans += s[x].first;
			s[x].second--;
		}
		else {
			Z:
			ans += a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int a, b, c;
    cin >> a >> b;
    c = b;
    if(b < 10){
        c += a*10;
    }else if(b < 100){
        c += a*100;
    }else{
        c += a*1000;
    }

    bool f = false;
    for(int i=1; i*i <= c; i++){
        if(i*i == c){
            f = true;
        }
    }
    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
  
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<stdlib.h>
    
int main(void){
    char set1[11]={0};
    int i;
    for(i=0;i<10;i++){
        scanf("%c",&set1[i]);
    }
        
    int count=0;
    i=0;
    while(set1[i]>'0' && set1[i]<='9'){
        count++;
        i++;
    }
    
    int difmin=114514;
    for(i=2;i<count;i++){
        int tmp1 = set1[i-2]-'0';
        int tmp2 = set1[i-1]-'0';
        int tmp3 = set1[i]-'0';
        int tmp = tmp1*100+tmp2*10+tmp3;
        int dif = abs(753-tmp);
        if(dif<difmin){
            difmin=dif;
        }
    }
    printf("%d\n",difmin);
    return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
cnt=0
zero=0
ans=0
mn=1000000001
for x in a:
  mn=min(mn,abs(x))
  if x<0:
    cnt+=1
    ans-=x
  else:
    ans+=x
  #print(ans)
cnt%=2
if cnt==0:
  print(ans)
else:
  print(ans-mn*2)
  
  
  
  
  
#print(ans,cnt,mn)

Measured memory_bytes: 14284
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

bool a[100005];
int p;

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

signed main() {
	int h, w;
	cin >> h >> w;
	char c[25][25];
	rep(y, h) {
		rep(x, w) {
			cin >> c[y][x];
		}
	}
	int ma = 0;
	rep(y, h) {
		rep(x, w) {
			if (c[y][x] == '#') continue;
			int sh[25][25];
			rep(i, h) {
				rep(j, w) sh[i][j] = INF;
			}
			sh[y][x] = 0;
			queue<P>que;
			que.push({ y,x });
			while (!que.empty()) {
				P now = que.front();
				que.pop();
				rep(i, 4) {
					int nx = now.second + dx[i];
					int ny = now.first + dy[i];
					if (nx >= 0 && ny >= 0 && nx < w && ny < h && c[ny][nx] == '.' && sh[ny][nx] == INF) {
						sh[ny][nx] = sh[now.first][now.second] + 1;
						que.push({ ny,nx });
					}
				}
			}
			rep(i, h) {
				rep(j, w) {
					if (sh[i][j] != INF) {
						ma = max(ma, sh[i][j]);
					}
				}
			}
		}
	}
	cout << ma << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int x,a,b,d1,d2;
    scanf("%d%d%d",&x,&a,&b);
    if(x>a) d1=x-a;
    else d1=a-x;
    if(x>b) d2=x-b;
    else d2=b-x;
    if(d1>d2) printf("B");
    else printf("A");
    return 0;
}


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

int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n>>m;
    long long a[n+5];

    for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);

    vector<long long>v;
    for(i=0;i<n;i++){
        x=abs(a[i]-m);
        v.push_back(x);
    }
    for(i=0;i<n;i++){
        if(i==0){
            y=v[i];
        }
        else{
            y=__gcd(y,v[i]);
        }
    }
    cout<<y<<endl;


}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b, c;
    cin  >> a >> b >> c;
    if(a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256