akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x; 
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x; 
        return true;
    }
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll n, m, k; cin >> n >> m >> k;
    vector<ll> a(n); FOR(i, 0, n) cin >> a[i];
    vector<ll> b(m); FOR(i, 0, m) cin >> b[i];

    vector<ll> asum(n+1);
    FOR(i, 0, n) {
        asum[i+1] += asum[i] + a[i];
    }
    vector<ll> bsum(m+1);
    FOR(i, 0, m) {
        bsum[i+1] += bsum[i] + b[i];
    }

    ll count = 0;
    FOR(i, 0, n+1) {
        if (asum[i] > k) break;

        ll timeleft = k - asum[i];
        auto it = upper_bound(bsum.begin(), bsum.end(), timeleft);
        chmax(count, i + it - bsum.begin() - 1);
    }
    cout << count << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 9508
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Integer[] l = new Integer[n];
    for (int i = 0; i < n; i++) {
      l[i] = sc.nextInt();
    }
    Arrays.sort(l, Collections.reverseOrder());
    int cnt = 0;
    for (int i = 0; i <= n-3; i++) {
      for (int j = i + 1; j <= n-2; j++) {
        boolean cuF = false;
        for (int k = j + 1; k <= n-1; k++) {
          if (l[i] < l[j] + l[k]) {
            cnt++;
            cuF = true;
            continue;
          }
          break;
        }
        if (!cuF) break;
      }
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 27352
s = input()
n = len(s)
cur1 = 1
cur2 = 0
ans1,ans2 = 0,0
for i in range(n):
    if cur1 != int(s[i]):
        ans1 +=1
    if cur2  != int(s[i]):
        ans2 += 1
    if cur1 ==1:
        cur1 = 0
    else:
        cur1 = 1
    if cur2 == 0:
        cur2 = 1
    else:
        cur2 = 0
print(min(ans1,ans2))

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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll N; cin >> N;
  ll A[N];
  rep(i, N){
    ll a;
    cin >> a;
    A[i] = a - i - 1;
  }
  sort(A, A+N);

  ll b = A[(N-1)/2];
  ll ans = 0;
  rep(i, N) ans += abs(A[i] - b);

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


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String[] inputs = input.split(" ");
        int count = Integer.valueOf(inputs[0]);
        int score = Integer.valueOf(inputs[1]);
        int[] a = new int[count];
        int[] b = new int[count];

        for( int i = 0 ; i<count ; i++) {
            String data = sc.nextLine();
            String[] datas = data.split(" ");
            a[i] = Integer.valueOf(datas[0]);
            b[i] = Integer.valueOf(datas[1]);
        }



        int maxA  = Integer.MIN_VALUE;

        for( int i = 0 ; i<count; i++ ) {
            if(a[i]>maxA) {
                maxA = a[i];
            }
            else if ( a[i] == maxA ){

            }
        }

        int moves = 0;

        Arrays.sort(b);
        int[] j = new int[count];
        for(int i = 0; i<count ;i++)
        {
            j[count-i-1] = b[i];
        }
        b = j;

            for( int i = 0; i<count ;i++)   {
                if(b[i]>=maxA) {
                    moves = moves+1;

                    score = score - b[i];
                    if(score<=0) {
                        break;
                    }
                }
            }
        if( score> 0 ) {
            int extraMoves  = score/maxA;
            if(score-(extraMoves*maxA)>0)
                moves = moves +extraMoves+1;
            else
                moves = moves+extraMoves;
        }
        System.out.println(moves);

    }
}


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

int main() {
  int N, K, sum, x;
  cin >> N;
  cin >> K;
  sum = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x < (K - x)) {
      sum += x;
    } else {
      sum += (K - x);
    }
  }
  sum *= 2;
  cout << sum << endl;
}


Measured memory_bytes: 256
import re

s = input()
key = 'keyence'
x = 0

str0 = re.compile(r'^' + key)
str1 = re.compile(r'' + key + '$')

if str0.search(s) != None or str1.search(s) != None:
  x = 1
else:
  for i in range(1,7):
    if x == 1:
      break
    str0 = re.compile(r'^' + key[:i])
    str1 = re.compile(r'' + key[i-6:] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class291
    {
        static void Main()
        {
            var QHSD = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long Q = QHSD[0];
            long H = QHSD[1];
            long S = QHSD[2];
            long D = QHSD[3];
            long N = int.Parse(Console.ReadLine());

            long s = Math.Min(Q * 4, Math.Min(H * 2, S));
            long d = Math.Min(2 * s, D);

            long ans = d *( N / 2);
            if (N % 2 == 1)
            {
                ans += s;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
S = input()
stack_0 = []
stack_1 = []

for s in S:
    if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s)

print(len(S) - len(stack_0) - len(stack_1))


Measured memory_bytes: 80920
#include "bits/stdc++.h"
using namespace std;
const int maxn = 300300;
int main(){
    long long n, k, ans = 0;
    cin >> n >> k;
    for(long long b = 1; b <= n; b++){
        long long cy = n / b;
        long long have = (b - 1 - k + 1);
        if(have <= 0) continue;
        ans += have * cy;
        long long last = n % b;
        if(last){
            long long now = last - k + 1;
            if(k == 0) now--;
            if(now > 0) ans += now;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, k; cin >> n >> k;
	vi v(n); cin >> v;
	int p;
	REP(i, n)
	{
		if (v[i] == 1) p = i;
	}
	int ans = p / (k - 1) + (p % (k - 1) != 0);
	p = ans * (k - 1);
	int r = max(0, n - p - 1);
	ans += r / (k - 1) + (r % (k - 1) != 0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

main()
{
  int N,M,X,Y,*x,*y,i,Z,xmax=-100,ymin=100;
  
  scanf("%d%d%d%d",&N,&M,&X,&Y);
  x = malloc(sizeof(int)*N);
  y = malloc(sizeof(int)*M);
  for(i=0; i<N; i++)
  {
    scanf("%d",&x[i]);
    if(xmax<x[i])xmax=x[i];
  }
  for(i=0; i<M; i++)
  {
    scanf("%d",&y[i]);
    if(ymin>y[i])ymin=y[i];
  }
  
  for(Z=X; Z<=Y; Z++)
  {
    if(Z!=X)
      if(xmax<Z&&Z<=ymin)
      {
        printf("No War\n");
        exit(0);
      }
  }
  printf("War\n");
  
}

Measured memory_bytes: 128
var input= require('fs').readFileSync('/dev/stdin', 'utf8').split("\n").map(Number);
var part = [];
input.some(function(x) {
  if (x == 0) return true;
  part.push(x);
});
console.log(input.map(function(x, i) {
  return x == 0 ? '' : 'Case ' + (i + 1) + ': ' + x;
}).join('\n').trim());

Measured memory_bytes: 19400
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>

using namespace std;

long long int a, b, c;
char s;
string str1,str2;
int main() {
	cin >> a;
	for (int k = 1; k < 10; k++) {
		if (k * 111 >= a) {
			cout << k * 111;
			return 0;
		}
	}
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

int main()
{
  int n,m;
  cin >> n >> m;
  ll sum = 0;
  rep(i,m)
  {
    ll tmp;
    cin >> tmp;
    sum += tmp;
  }
  ll ans = n - sum;
  if(ans < 0) ans = -1;
  cout << fixed << ans << endl;
  return 0;
}

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

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

  vector<int> s;             //インデックス番目にいる町
  vector<int> ord(n+1,-1);   //インデックスに対応する町に何番目に訪れたか
  int c = 1, l = 0;          //c:周期、l:
  {
    int v = 1;
    while (ord[v] == -1) {
      ord[v] = s.size();     //インデックスに対応する町に何番目に訪れたかを更新
      s.push_back(v);        //インデックス番目にどこの町を訪れたかを更新
      v = a[v-1];            //現在位置を更新
    }
    c = s.size() - ord[v];   //周期を計算
    l = ord[v];              //周期に入る前に何回テレポートするかを計算
  }

  if (k < l) cout << s[k] << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l+k] << endl;
  }
  return 0;
}


Measured memory_bytes: 5780
import sys
sys.setrecursionlimit(10**5+5)
input = sys.stdin.readline

N,M=map(int,input().split())
adj=[[] for _ in range(N)]

for i in range(M):
    x,y=map(int,input().split())
    x-=1
    y-=1
    adj[x].append(y)
    
dp=[-1]*N#i番目絡みた最長経路
for i in range(N):
    if len(adj[i])==0:
        dp[i]=0

def rec(ii):
    new=0
    for to in adj[ii]:
        if dp[to]!=-1:
            new=dp[to]
        else:
            new=rec(to)
        dp[ii]=max(new+1,dp[ii])
    return dp[ii]
        
for i in range(N):
    rec(i)
    
print(max(dp))

Measured memory_bytes: 59008
#include<stdio.h>
#include<stdlib.h>
int main()
{
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);


  if (abs(a-c)<=d) printf("Yes\n");
  else if (abs(a-b)<=d && abs(b-c)<=d) printf("Yes\n");
  else printf("No\n");

  return 0;
}

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

using namespace std;

int main(void) {
    int i, index;
    int H, W, new_H;
    string s_tmp;
    vector<string> C, new_C;
    // get input ---------------------------------
    cin >> H >> W;
    new_H = H*2;
    for(i = 0; i < H; i++) {
        cin >> s_tmp;
        C.push_back(s_tmp);
    }
    // extend C ----------------------------------
    for(i = 1; i <= new_H; i++) {
        index = (i+1)/2;
        index--;
        new_C.push_back(C[index]);
    }
    // disp answer ------------------------------
    for(i = 0; i < new_H; i++) {
        cout << new_C[i] << endl;
    }
    return 0;
}





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

using namespace std;

using int64 = long long;

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

  int64 ai, ao, at, aj, al, as, az;
  cin >> ai >> ao >> at >> aj >> al >> as >> az;

  int64 ans = 0;
  ans += ao;

  int odd_count;
  if (ai % 2 == 1) odd_count++;
  if (aj % 2 == 1) odd_count++;
  if (al % 2 == 1) odd_count++;
  if (odd_count == 0 || odd_count == 3) {
    ans += ai + aj + al;
  } else if (odd_count == 1) {
    ans += ai + aj + al - 1;
  } else {
    if (ai == 0 || aj == 0 || al == 0) {
      ans += ai + aj + al - 2;
    } else {
      ans += ai + aj + al - 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int a_id, z_id;
  for (int i = s.length() - 1; i >= 0; i--)
  {
    if (s[i] == 'A')
      a_id = i;
  }
  for (int i = 0; i < s.length(); i++)
  {
    if (s[i] == 'Z')
      z_id = i;
  }
  cout << z_id - a_id + 1 << endl;
  return 0;
}

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

using namespace std;
// jebote stupidast
int main() {
    string s;
    cin >> s;
    long long n;
    cin >> n;
    bool rev = 0;
    for(long long i = 0; i < n; ++i){
        long long t; cin >> t;
        if(t == 1)rev ^= 1;
        else{
            long long f;
            cin >> f;
            string c;
            cin >> c;
            if(rev == 0){
                if(f == 1) s.insert(0, c);
                else s+= c;
            }else{
                if(f == 1) s+= c;
                else s.insert(0, c);
            }
        }
    }
    if(rev == 1){
        reverse(s.begin(), s.end());
        cout << s;
    }else cout << s;
	return 0;

}


Measured memory_bytes: 900
#include <stdio.h>

int main() {
    int weeks = 0;
    double money = 100.0d;
    scanf("%d", &weeks);

    for (int i = 0; i < weeks; ++i) {
        money *= 1.05d;
        int temp = (int) money;
        if (temp < money) {
            temp++;
        }
        money = temp;
    }

    int result = (int) money;
    result *= 1000;
    printf("%d\n", result);

    return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>


int partition(int A[], int p, int r){
    int x,i;
    x = A[r];
    i = p-1;
    for(int j=p;j<r;j++){
        if(A[j]<=x){
            i = i+1;
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    int tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    return i+1;

}

int main(){
    int n;
    scanf("%d",&n);
    int A[n];
    for(int i=0;i<n;i++)
        scanf("%d",&A[i]);
    int res = partition(A,0,n-1);
    for(int i=0;i<n;i++){
        if (i) printf(" ");
        if(i==res)
            printf("[%d]",A[i]);
        else
            printf("%d",A[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2192
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){

  int h, w, k, t, p;
  cin >> h >> w >> k;
  char s;
  int a[h][w];
  int b[h][w];
  t = 1;
  for ( int i = 0; i < h; i++ ){
    for ( int j = 0; j < w; j++ ){
      cin >> s;
      if ( s == '#' ) {
        a[i][j] = t;
        t++;
      }
      else a[i][j] = 0;
    }
    p = 0;
    for ( int j = 0; j < w; j++ ){
      if ( a[i][j] > 0 ) {
        p = a[i][j];
      }
      else {
        a[i][j] = p;
      }
    }
    
    p = 0;
    for ( int j = w-1; j > -1 ; j-- ){
      if ( a[i][j] > 0 ) {
        p = a[i][j];
      }
      else {
        a[i][j] = p;
      }
    }
  }
  
  for ( int j = 0; j < w; j++ ){
    p = 0;
    for ( int i = 0; i < h; i++ ){
      if ( a[i][j] > 0 ) {
        p = a[i][j];
      }
      else {
        a[i][j] = p;
      }
    }
    
    p = 0;
    for ( int i = h-1; i > -1 ; i-- ){
      if ( a[i][j] > 0 ) {
        p = a[i][j];
      }
      else {
        a[i][j] = p;
      }
    }
  }  
  for ( int i = 0; i < h; i++ ){
    for ( int j = 0; j < w-1; j++ ){
      cout << a[i][j] << ' ' ;
    }
    cout << a[i][w-1] << endl;
  }
  return 0;
  
}

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

int main() {
  int S;
  cin >> S;
  int h, m, s;
  s = S % 60;
  m = (S - s) / 60 % 60;
  h = ((S - s) / 60 - m) / 60;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}



Measured memory_bytes: 3116
a,b=map(float,input().split())
a_tax = a*100//8
b_tax = b*100//10
min_tax = 0

if a_tax <= b_tax:
    min_tax = int(a_tax)
else:
    min_tax = int(b_tax)

r_a_tax = int(min_tax*0.08)
r_b_tax = int(min_tax*0.1)

flag = True
while(flag):
    if r_a_tax == a and r_b_tax == b:
        flag = False
    elif r_a_tax > a or r_b_tax > b:
        print(-1)
        exit()
    else:
        min_tax += 1
        r_a_tax = int(min_tax*0.08)
        r_b_tax = int(min_tax*0.1)

print(min_tax)


Measured memory_bytes: 38384
n=int(input())
a = [0]*(20000)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            if i**2+j**2+k**2 >= n:
                break
            a[i**2+j**2+k**2+i*j+j*k+i*k]+=1
for i in range(1,n+1):
    print(a[i])



Measured memory_bytes: 9256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class T1 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.ni();
            int b = in.ni();
            out.print(a * b - a - b + 1);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 20820
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll A(N);
        rep(i, 0, N) cin >> A[i];
        vll L(N+1, 0), R(N+1, 0);
        rep(i, 1, N+1) {
                L[i] = g(A[i-1], L[i-1]);
        } 
        for (ll i = N-1; i >= 0; --i) {
                R[i] = g(A[i], R[i+1]);
        }
        //print1d(L);
        //print1d(R);
        vll ans;
        rep(i, 0, N) {
                ans.push_back(g(L[i], R[i+1]));
        }
        //print1d(ans);
        cout << *max_element(all(ans)) << endl;
}

Measured memory_bytes: 3704
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	N := io.NextInt()
	A := make([]int, N)
	sumA := make([]int, N+1)
	sumMap := map[int][]int{}
	sumMap[0] = []int{0}
	result := 0
	for i := 0; i < N; i++ {
		a := io.NextInt()
		A[i] = a
		sumA[i+1] = sumA[i] + a
		if len(sumMap[sumA[i+1]]) > 0 {
			result += len(sumMap[sumA[i+1]])
			sumMap[sumA[i+1]] = append(sumMap[sumA[i+1]], sumA[i+1])

		} else {
			sumMap[sumA[i+1]] = []int{sumA[i+1]}
		}
	}
	fmt.Println(result)
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if ((A + B) > (C + D)) {
		cout << "Left" << endl;
	}
	else if ((A + B) < (C + D)) {
		cout << "Right" << endl;
	}
	else{
		cout << "Balanced" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<(a!=c)<<endl;
  return 0;
}


Measured memory_bytes: 256
#ifndef CLASS_MODINT
#define CLASS_MODINT

#include <cstdint>

template <std::uint32_t mod>
class modint {
private:
	std::uint32_t n;
public:
	modint() : n(0) {};
	modint(std::int64_t n_) : n((n_ >= 0 ? n_ : mod - (-n_) % mod) % mod) {};
	static constexpr std::uint32_t get_mod() { return mod; }
	std::uint32_t get() const { return n; }
	bool operator==(const modint& m) const { return n == m.n; }
	bool operator!=(const modint& m) const { return n != m.n; }
	modint& operator+=(const modint& m) { n += m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator-=(const modint& m) { n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator*=(const modint& m) { n = std::uint64_t(n) * m.n % mod; return *this; }
	modint operator+(const modint& m) const { return modint(*this) += m; }
	modint operator-(const modint& m) const { return modint(*this) -= m; }
	modint operator*(const modint& m) const { return modint(*this) *= m; }
	modint inv() const { return (*this).pow(mod - 2); }
	modint pow(std::uint64_t b) const {
		modint ans = 1, m = modint(*this);
		while (b) {
			if (b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}
};

#endif // CLASS_MODINT

#include <vector>
#include <iostream>
#include <functional>
using namespace std;
using mint = modint<998244353>;
int main() {
	int N, K;
	cin >> N >> K;
	vector<mint> fact(K + 1), factinv(K + 1);
	fact[0] = 1;
	for (int i = 1; i <= K; ++i) fact[i] = fact[i - 1] * i;
	factinv[K] = fact[K].inv();
	for (int i = K; i >= 1; --i) factinv[i - 1] = factinv[i] * i;
	function<mint(int, int)> comb = [&](int x, int y) {
		if (y < 0 || x < y) return mint(0);
		return fact[x] * factinv[y] * factinv[x - y];
	};
	mint ans = 0;
	for (int i = 0; i <= K; ++i) {
		// i = number of red balls
		int red = i, blue = K - i;
		int diff = red - blue;
		if (diff >= N) {
			ans += comb(K, red);
		}
		else if (diff > 0 && N - diff <= blue) {
			int sx = red - (N - diff), sy = 0;
			int gx = sx + blue, gy = red;
			mint ways = comb((gx - sx) + (gy - sy), gx - sx) - comb((gx - sx) + (gy - sy), gy - sx - 1);
			ans += ways;
		}
		else if (diff == 0 && N - diff <= blue) {
			int sx = red - (N - diff) + 1, sy = 0;
			int gx = sx + blue - 1, gy = red;
			mint ways = comb((gx - sx) + (gy - sy), gx - sx) - comb((gx - sx) + (gy - sy), gy - sx - 1);
			ans += ways;
		}
	}
	cout << ans.get() << endl;
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007LL
#define N 10
#define endl '\n'

using namespace std;

char matrix[N][N];
int cpy[N][N], n, m, k, ans, tot, black;


int main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;

    for(int i=0; i < n; ++i) {
        for(int j=0; j < m; ++j) {
            cin >> matrix[i][j];
            tot += (matrix[i][j] == '#');
        }
    }
    for(int i=0; i < (1 << n); ++i) {
        for(int j=0; j < (1 << m); ++j) {

            black = 0;

            for(int u=0; u < n; ++u) {
                for(int v=0; v < m; ++v) {
                    if((((1 << u) & i) || ((1 << v) & j))) {
                        black += (matrix[u][v] == '#');
                    }
                }
            }

            if(tot - black == k) {
                ans++;
            }
        }
    }
    cout << ans << endl;


    return 0;

}


Measured memory_bytes: 3552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		int taroscore = 0;
		int hanakoscore = 0;
		for (int i = 0; i < n; i++) {
			String[] str2 = br.readLine().split(" ");

			if (str2[0].compareTo(str2[1]) > 0) {
				taroscore += 3;
			} else if (str2[0].compareTo(str2[1]) < 0) {
				hanakoscore += 3;
			} else {
				taroscore += 1;
				hanakoscore += 1;
			}
		}
		System.out.println(taroscore + " " + hanakoscore);
	}
}

Measured memory_bytes: 25516
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  
  for(i=1;i<n+1;i++){
    scanf("%hd",&A[i]);
  }
  for(i=0;i<=VMAX;i++){
    C[i]=0;
  }
  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=VMAX;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=n;j>0;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n+1;i++){
    if(i!=n)
    printf("%hd ",B[i]);
    else
       printf("%hd\n",B[i]);
  }

  return 0;
}



Measured memory_bytes: 9584
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std; typedef long long ll;const ll INF = 1e18; const ll MOD = 1e9+7;
typedef pair<int,int> P; const int xx[4]={1,-1,0,0}, yy[4]={0,0,1,-1}; struct tp{ll x1,y1,x2,y2;};

int main(){
  ll n,k,l,r; cin>>n>>k>>l>>r; ll m1=n/2, m2=n-n/2, an=0;
  ll a[n]; for(int i=0;i<n;i++) cin>>a[i];
  for(ll u=0,v=k;u<=k;u++,v--) {
    vector<ll> g1, g2;
    for(int i=0;i<(1<<m1);i++) {
      ll nm=0;
      for(int j=0;j<m1;j++) {if (i & (1<<j)) nm++;}
      if (nm != u) continue;
      ll sm=0;
      for(int j=0;j<m1;j++) {if (i & (1<<j)) sm += a[j];}
      g1.push_back(sm);
    }
    for(int i=0;i<(1<<m2);i++) {
      ll nm=0;
      for(int j=0;j<m2;j++) {if (i & (1<<j)) nm++;}
      if (nm != v) continue;
      ll sm=0;
      for(int j=0;j<m2;j++) {if (i & (1<<j)) sm += a[m1+j];}
      g2.push_back(sm);
    }
    //for(ll x:g1) cout<<x<<" "; cout<<endl;
    //for(ll x:g2) cout<<x<<" "; cout<<endl;

    sort(g1.begin(), g1.end());
    for(ll x:g2) {
      auto it1=lower_bound(g1.begin(), g1.end(), l-x);
      auto it2=upper_bound(g1.begin(), g1.end(), r-x);
      an += it2-it1;
    }
    //cout<<an<<endl;
  }
  cout<<an<<endl;
}


Measured memory_bytes: 7712
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    int minnum = 10000000;
    int count = 0;
    for(int i = 0; i < n; i++){
        if(p[i] < minnum){
            count += 1;
        }
        minnum = min(minnum, p[i]);
        //cout << minnum;
    }
    cout << count;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main()
{
    string s;
    string k;
    cin>>s;
    cin>>k;
    int count=0;
    int endpoint=0;
    int kint=(int)k[0];
    int korder=k.length();

    for(int i=0; i<s.length();i++)
    {
        if(s[i]=='1')
        {
            count++;
        }
        else
        {
            endpoint=i;
            break;
        }
    }

    if(korder>2)
    {
        cout<<s[endpoint]<<endl;
    }
    else if(atoi(k.c_str())<=count)
    {
        cout<<1<<endl;
    }
    else
    {
        cout<<s[endpoint]<<endl;
    }
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Print(bool c)
{
    if (c)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int kaijo(int x)
{
    int ans = 1;
    rep(i, 1, x + 1) ans *= i;
    return ans;
}

string n_shin(int x, int n)
{
    string s;
    while (x > 0)
    {
        s += to_string(x % n + 1);
        x /= n;
    }
    while (s.size() < n)
    {
        s += '0';
    }
    s.reserve();
    //cout << s << endl;
    return s;
}

int main()
{
    int n, m, p;
    string s;
    cin >> n >> m;
    vector<bool> is(n, false);
    vi wrong(n, 0);

    int ans = 0, pen = 0;
    rep(i, 0, m)
    {
        cin >> p >> s;
        if (is[p])
            continue;
        if (s == "AC")
        {
            is[p] = true;
            ans++;
            pen += wrong[p];
        }
        else
            wrong[p]++;
    }
    cout << ans << " " << pen << endl;
}


Measured memory_bytes: 640
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]

for i in range(len(A)):
    a.append(a[i] + A[i])
for i in range(len(B)):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while a[i] + b[j] > K:
        j -= 1
    ans = max(ans, i+j)
    
print(ans)

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

string s;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> s;
  int flag = 1;
  for (int i = 0; i < s.size(); i += 2) {
    if (s[i] != s[0]) flag = 0;
  }  
  for (int i = 1; i < s.size(); i += 2) {
    if (s[i] != s[1]) flag = 0;
  }
  if (flag) {
    cout << "Second" << endl;
    return 0;
  }
  cout << ((s.size() - 2 - (s.front() == s.back())) % 2 == 1 ? "First" : "Second") << endl;

  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
int main()
{
    char a[15], b[15], c[15];
    scanf("%s%s%s", a, b, c);
    if(a[strlen(a)-1] == b[0] && b[strlen(b)-1] == c[0])
        printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>




using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << setprecision(7) << (x) << endl;

struct idxx{
    int a;
    int b;
    int c;
};

long double pi = 3.14159265359;
map<tuple<int,int,int>,int> mp;

int n;
int l[10000];
int minn=10000000;
int maxn=-1;
int ans= 0;

void b_search(int left, int right, int x){
    int mid = (right + left)/2;
    if(right == left){
        ;
    }
    else if(l[mid] < x){    
        b_search(mid+1,right,x);
        maxn = max(maxn,mid);
    }
    else{
        minn = min(minn,mid);
        b_search(left, mid,x);
    }
}

int main(){
    cin >> n;
    rep(i,n) cin >> l[i];
    sort(l,l+n);
    rep(i,n-2){
        for(int j=i+1;j<n-1;j++){
            int a = l[i];
            int b = l[j];
            minn=100000000;
            maxn=-1;
            b_search(0,n,a+b);
            // cout << minn << " " << maxn << endl;
            int idx = maxn;
            ans += maxn - j;
        }
    }
    cout << ans << endl;


return 0;
}

Measured memory_bytes: 3640
import sys
input = lambda: sys.stdin.readline().rstrip()
from heapq import heapify, heappush as hpush, heappop as hpop
H, W, K = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "@" else 0 for a in input()] + [1]
X += [1] * (W + 2)
X += X[:]
H, W = H+2, W+2
HW = H * W
s, t = x1 * W + y1, x2 * W + y2
ss, tt = s + HW, t + HW
def dijkstra():
    n = 2 * H * W
    h = [(0, s), (0, ss)]
    D = [-1] * n
    done = [0] * n
    D[s] = 0
    D[ss] = 0
    while h:
        d, i = hpop(h)
        done[i] = 1
        if i < HW:
            for j in (i+1, i-1):
                nd = d + 1
                if X[j]: continue
                if D[j] < 0 or D[j] > nd:
                    if done[j] == 0:
                        hpush(h, (nd, j))
                        D[j] = nd
        else:
            for j in (i+W, i-W):
                nd = d + 1
                if X[j]: continue
                if D[j] < 0 or D[j] > nd:
                    if done[j] == 0:
                        hpush(h, (nd, j))
                        D[j] = nd
            
        j = i + HW if i < HW else i - HW
        nd = (d + K - 1) // K * K
        if X[j]: continue
        if D[j] < 0 or D[j] > nd:
            if done[j] == 0:
                hpush(h, (nd, j))
                D[j] = nd
    return [-(-a//K) for a in (D[t], D[tt]) if a >= 0]

di = dijkstra()
print(min(di) if di else -1)

Measured memory_bytes: 195036
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

const M:usize = 2019;

fn main() {
    scan!(s; String);
    // let mut book = vec![vec![0; M]; s.len()];
    let s = s.chars().map(|c| {
        (c as i32 - 48) as usize
    }).collect::<Vec<_>>();

    let mut res = 0;

    let mut book = vec![0; M];
    book[s[0]] = 1;
    for i in 1..s.len() {
        let mut new_book = vec![0; M];
        new_book[s[i]] = 1;
        for j in 0..M {
            let r = (j * 10 + s[i]) % M;
            new_book[r] += book[j];
        }
        res += new_book[0];
        book = new_book;
    }

    println!("{}", res);
}


Measured memory_bytes: 3804
//Name : Rupa Dey
  //Date : 17 September 2020 // shuvo mohaloya...
//joi sri gour hori gobindo...
//gobindo ja hobe vlor jonnoi hobe..
#include<bits/stdc++.h>
#define ll long long
#define d double
#define ld long double
#define vi vector<int>
#define vul vector<ull>
#define vl vector<ll>
#define pb push_back
#define si set<int>
#define sl set<ll>
#define yes cout<<"YES\n"<<endl
#define no cout<<"NO\n"<<endl
#define ys cout<<"Yes\n"<<endl
#define n0 cout<<"No\n"<<endl
#define test cin>>t; while(t--)
#define for(i,a,n) for(i=a;i<n;i++)
#define mp make_pair
#define ft first
#define sc second
#define gp ' ';
#define MAX 9999999
#define MOD 1000000007
#define nd endl
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k,i,j,cnt=0;
    cin>>n;
    int a;
    si seti;
   // for(i,0,n) cin>>a[i];
    for(i,0,n)
    {
       cin>>a;
       seti.insert(a);
    }
    //cout<<seti.size()<<nd;
      if(seti.size()!=n) no;
       else yes;

}
//hare krishna...
//hey gobindo kripa koro......
//only gobindo exists..^..


Measured memory_bytes: 13024
s = input()
t = input()
sconv = [-1] * 26
tconv = [-1] * 26
for i in range(len(s)):
    sa = ord(s[i]) - ord('a')
    ta = ord(t[i]) - ord('a')
    if (sconv[sa] > 0 and sconv[sa] != ta) or (tconv[ta] > 0 and tconv[ta] != sa):
        print('No')
        exit()
    sconv[sa] = ta
    tconv[ta] = sa

print('Yes')

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

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

using namespace std;
namespace geom{
#define at(i) ((*this)[i])
#define pb push_back
#define X real()
#define Y imag()
#define SELF (*this)
typedef long double R;
typedef complex<R> P;
const R EPS = 1e-8;
const R PI=3.14159265358979323846264338327950288;
enum { TURE = 1, FALSE = 0, BORDER= -1};
inline int sig(const R&x){return (abs(x)<EPS?0:x>0?1:-1);}
inline int less(const R &x,const R &y){return sig(x-y)?x<y:BORDER;}
inline R inp(const P &a,const P &b){return (conj(a)*b).X;}
inline R outp(const P &a,const P & b){return (conj(a)*b).Y;}
inline R norm(const P &p){return p.X*p.X+p.Y*p.Y;}
inline P unit(const P & p){return p/abs(p);}
inline P proj(const P &s,const P &t){return t*inp(s,t)/norm(t);}
struct L :public vector<P>{
  L(const P &p1,const P &p2){this->pb(p1);this->pb(p2);}
  L(){}
  P dir()const {return at(1)-at(0);}
  int online(const P &p) const {return !sig(outp(p-at(0),dir()));}
};
struct S: public L {
    S(const P &p1, const P &p2): L(p1,p2){}
    S(){}
    int online(const P &p) const{
        if(!sig(norm( p-at(0) )) || !sig(norm(p - at(1))) ) return BORDER;
        return !sig(outp(p-at(0), dir())) && inp(p-at(0), dir()) > EPS && inp(p-at(1),-dir()) > -EPS;
    }
};
struct C :public P{
  C(){}
  C(const P &p,const R r):P(p),r(r){}
  R r;
  int inside(const P &p)const { return less(norm(p-SELF),r*r);}
};
//inline P proj(const P &s,const L &t){return t[0] + proj(s-t[0], t[1]-t[0]);}

inline int intersect (const C &a,const C &b){
  return less((a.r-b.r)*(a.r-b.r),norm(a-b))+less(norm(a-b),(a.r+b.r)*(a.r+b.r))-1;
}

inline S crosspoint(const C &c1,const C &c2){
  if(!intersect(c1,c2)) return S();
  R d=abs(c1-c2);
  R x=(c1.r*c1.r-c2.r*c2.r+d*d)/(2*d);
  R h=sqrt(max<R>(0.,c1.r*c1.r-x*x));
  P u=unit(c2-c1);
  return S(c1+u*x+u*P(0,-1)*h,c1+u*x+u*P(0,1)*h);
}

// inline S crosspoint(const C &c,const L &l){
//   R d2=dist2(l,c);
//   if(c.r*c.r+EPS < d2) return S();
//   P m= proj(c,l);
//   P u = unit(l[1]-l[0]);
//   R d=sqrt(max<R>(.0,c.r*c.r-d2));
//   return S(m+u*d,m-u*d);
// }

S circlePPR(const P& a, const P& b, R r){
    return crosspoint( C(a,r), C(b,r) );
}
}
using namespace geom;

int main(){
    int N;
    while(cin>>N, N){
        int ans = 1;
        P po[305];
        rep(i,N){
            R x, y;
            cin >> x >> y;
            po[i] = P(x, y);
        }
        rep(i,N) rep(j,i){
            //if( i==j ) continue;
            S s = circlePPR( po[i], po[j], 1.0 );
            //if( s.empty() ) continue;
            //for(auto t: s) cout << t << " "; cout << endl;
            for(auto k: s){
                int count = 0;
                rep(h,N){
                    if( abs(k-po[h]) < 1.0 + EPS ){
                        count++;
                    }
                }
                ans = max(ans, count);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;
map<ll, ll> mp;

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx;
    int dy = ty - sy;

    cout << string(dx, 'R') << string(dy, 'U');
    cout << string(dx, 'L') << string(dy, 'D');
    cout << 'D' << string(dx+1, 'R') << string(dy+1, 'U') << 'L';
    cout << 'U' << string(dx+1, 'L') << string(dy+1, 'D') << 'R' << endl;


    return 0;
}


Measured memory_bytes: 256
program main
    implicit none
    integer K, ans, a, b, c
    ans = 0
    read (*, *) K
    do a = 1, K
        do b = 1, K
            do c = 1, K
                ans = ans + gcd(a, gcd(b, c))
            end do
        end do
    end do
    write(*, '(I0)') ans
    stop
contains
    recursive integer function gcd(x, y) result(ret)
        implicit none
        integer x, y
        if (y == 0) then
            ret = x
        else
            ret = gcd(y, mod(x, y))
        end if
        return
    end function
end program main

Measured memory_bytes: 2912
#include <stdio.h>

int main(){
	int S,h,m,s;
	scanf("%d",&S);
	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 3600 % 60;
	printf("%d:%d:%d\n",h ,m ,s);
	return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
int  N, K, A[200005], dp[200005];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> K;
	for (int i = 0; i < K; i++)
	{
		cin >> A[i];
		dp[K - 1] += A[i];
	}
	for (int i = K; i < N; i++)
	{
		cin >> A[i];
		dp[i] = dp[i - 1] + A[i] - A[i - K];
	}
	printf("%.6lf\n", (double)(*max_element(dp + K - 1, dp + N) + K) / 2);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main() {
    
    int a,b,c;
    cin >> a >> b >> c;
    
    if(a < b){
        if(b < c){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
    
    
    
    
    
    
    
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using 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)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int n, m, c; cin >> n >> m >> c;
	vector<int>ac_code(m);
	rep(i, m)cin >> ac_code[i];
	vector<vector<int>>A(n, vector<int>(m));
	rep(i, n)rep(j, m)cin >> A[i][j];
	int ans = 0;
	rep(i, n) {
		int cnt = 0;
		rep(j, m) {
			cnt += A[i][j]*ac_code[j];
		}
		if (cnt + c > 0)++ans;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
N,T = map(int, input().split())
ct=[list(map(int, input().split())) for _ in range(N)]
#print(ct)
max=1001
for i in range(N):
    if ct[i][1]>T:
        continue
    else:
        if ct[i][0]<max:
            max=ct[i][0]
if max==1001:
    print('TLE')
else:
    print(max)

Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int n;
char s[10010];
bool ok(int l,int r)
{
	for (int i=l;i<=r;i++) if (s[i]!=s[r-(i-l)]) return 0;
return 1;
}
int main()
{
	scanf("%s",s+1); n=strlen(s+1);
	if (!ok(1,n)) {printf("No\n"); return 0;}
	if (!ok(1,(n-1)/2)) {printf("No\n"); return 0;}
	if (!ok((n+3)/2,n)) {printf("No\n"); return 0;}
	printf("Yes\n");
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n; cin >> n;
    string s; cin >> s;
    rep(i,s.length()){
        int x = s[i] - 'A';
        x = (x+n)%26;
        putchar('A' + x);
    }
}

Measured memory_bytes: 256