akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N(111111);
int a[N];
long long s[N], sp[N];
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i(1); i <= n; i++) {
		scanf("%d", &a[i]);
		s[i] = s[i - 1] + a[i];
		sp[i] = sp[i - 1] + max(0, a[i]);	
	}
	long long ans(-1e18);
	for(int i(1); i + k - 1 <= n; i++) {
		ans = max(ans, sp[i - 1] + sp[n] - sp[i + k - 1] + s[i + k - 1] - s[i - 1]);
		ans = max(ans, sp[i - 1] + sp[n] - sp[i + k - 1]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 2176
#include<iostream>

using namespace std;

int SumOfDegits(int n)
{
        int sum = 0;
        while(n>0)
        {
                sum+=(n%10);
                n/=10;
        }
        return sum;
}

int main(void)
{
        int n,a,b;
        cin >> n >> a >> b;

        int count = 0;

        for(int i=1;i<=n;i++)
        {
                int x = SumOfDegits(i);
                if(a<=x && x<=b)
                        count+=i;
        }

        cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int M=1e4;
int a[M],b[M],c[M];
void jingwei(int cnt){
	while (c[cnt]>=10){
		c[cnt+1]+=c[cnt]/10;
		c[cnt]%=10;
		cnt++;
	}
}
int n1,n2,n3;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	for (int i=s.size()-1;i>=0;i--){
		a[++n1]=s[i]-'0';
	}
	n--;
	bool flag=1,f0=0;
	while (n--){
		cin>>s;
		if (!flag){
			if (s=="0"){
				f0=1;
			}
			continue;
		}
		n2=0;
		for (int i=s.size()-1;i>=0;i--){
			b[++n2]=s[i]-'0';
		}
		for (int i=1;i<=n1;i++){
			int cnt=i;
			for (int j=1;j<=n2;j++){
				c[cnt]+=a[i]*b[j];
				jingwei(cnt);
				cnt++;
			}
		}
		for (int i=M-1;i>=0;i--){
			if (c[i]){
				n3=i;
				break;
			}
		}
		n1=n3;
//		cout<<n3<<endl;
		if (n3==19){
			bool f2=1;
			if (c[n3]!=1){
				flag=0;
				continue;
			}
//			for (int i=19;i>=1;i--)cout<<c[i];
//			cout<<endl; 
			for (int i=1;i<=18;i++){
				if (c[i]!=0){
					f2=0;
//					cout<<i<<endl;
					break;
				}
			}
			if (f2==0){
				flag=0;
				continue;
			}
//			cout<<"hi"<<endl;
		}
		if (n3>19){
			flag=0;
			continue;
		}
		for (int i=1;i<=n1;i++)a[i]=c[i],c[i]=0;
	}
	if (!flag){
		if (f0==1){
			cout<<0<<endl;
			return 0;
		}else{
			cout<<-1<<endl;
			return 0;
		}
	}else{
		for (int i=n1;i>=1;i--)cout<<a[i];
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
ll l,r;
int main(){
  scanf("%lld%lld",&l,&r);
  if(r - l >= 2019) printf("0\n");
  else{
    ll res = 0x3f3f3f3f3f3f3f3fll;
    for(int i = l;i <= r;i++){
      for(int j = i + 1;j <= r;j++){
        res = min(res,(ll)i * j % 2019);
      }
    }
    printf("%lld\n",res);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,a,b) for(int i= (int)(a); i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define what_is(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
const int N = 1e6+7 ;
string s ;

int main(){fast ;
	int n,k ;
	cin >> n >> k;
	cin >> s ;
	k-- ;
	s[k] = (s[k]-'A') + 'a' ;
	cout << s << endl ;
		
}






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

typedef long long ll;

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

    ll b = 0, d = 0, f = 0;
    ll ans = LLONG_MIN;

    ll cake[n][3];

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

    for(int i = 0; i < 8; i++){
        ll score[n] = {};
        for(int j = 0; j < n; j++){
            if(i & 1 == 1)      score[j] += cake[j][0];
            else                score[j] -= cake[j][0];
            if(i/2 & 1 == 1)    score[j] += cake[j][1];
            else                score[j] -= cake[j][1];
            if(i/4 & 1 == 1)    score[j] += cake[j][2];
            else                score[j] -= cake[j][2];
        }

        sort(score, score+n);
        reverse(score, score+n);

        ll can = 0;
        for(int i = 0; i < m; i++)  can += score[i];

        ans = max(can, ans);
    }

    cout << abs(ans) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for (int i = 1; i <= n; i++) {
			if (i % 3 == 0) {
				System.out.print(" " + i);
			} else if (i % 10 == 3) {
				System.out.print(" " + i);
			} else if (i / 10 == 3) {
				System.out.print(" " + i);
			} else if ((i % 100) / 10 == 3) {
				System.out.print(" " + i);
			} else if ((i % 1000) / 100 == 3) {
				System.out.print(" " + i);
			} else if ((i % 10000) / 1000 == 3) {
				System.out.print(" " + i);
			}else if ((i % 100000) / 10000 == 3) {
				System.out.print(" " + i);
			}
		}
		System.out.println();
	}
}



Measured memory_bytes: 28760
n = gets.to_s.to_i
@s = gets.to_s.chomp.bytes

@h = Hash.new{|h, k| h[k] = []}
@s = @s.unshift(32)
@s.each_with_index{|c, i| @h[c] << i }

def update(i, c)
  d = @s[i]
  return if c == d
  @s[i] = c
  @h[d].delete_at(@h[d].bsearch_index{|x| x >= i})
  @h[c].insert((@h[c].bsearch_index{|x| x >= i} || -1), i)
end

gets
readlines.each do |x|
  a, b, c = x.to_s.chomp.split

  if a == '1'
    i = b.to_i
    update(i, c.ord)
  else
    l, r = b.to_i, c.to_i
    puts @h.each_value.count {|e| ( e.bsearch{|x| x >= l} || n+1 ) <= r}
  end
end

Measured memory_bytes: 14384
import java.math.BigDecimal;
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

        System.out.println(ans);
        return;
    }
}


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

int main() {
  int N;
  cin >> N;
  map<int, int> freq;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ++freq[a - 1]; 
    ++freq[a];
    ++freq[a + 1];
  }
  int res = 0;
  for (auto &p: freq) {
    res = max(res, p.second);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4736
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(string s, long long x, long long y) {

  int nx = 0, ny = 0;

  int i = 0;
  for (; i < s.size(); ++i) {
    if (s[i] != 'F')
      break;
    x--;
  }

  dump(x, y);

  int c = 0;
  bool v = false;
  vi vv, bb;

  for (; i < s.size(); ++i) {
    if (s[i] == 'T') {

      if (c > 0) {
        if (v) {
          vv.push_back(c);
        } else {
          bb.push_back(c);
        }
      }

      v ^= true;
      c = 0;
      continue;
    } else {
      c++;
    }
  }

  if (c > 0) {
    if (v) {
      vv.push_back(c);
    } else {
      bb.push_back(c);
    }
  }

  sort(ALL(vv));
  reverse(ALL(vv));
  for (auto b : vv) {
    dump("v:", b);
    if (y >= 0) {
      y -= b;
    } else {
      y += b;
    }
  }

  sort(ALL(bb));
  reverse(ALL(bb));
  for (auto b : bb) {
    dump("b:", b);
    if (x >= 0) {
      x -= b;
    } else {
      x += b;
    }
  }

  dump(x, y);

  if (x == 0 && y == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  long long y;
  string s;
  long long x;
  cin >> s;
  cin >> x;
  cin >> y;
  solve(s, x, y);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
  int n,l;
  cin>>n>>l;
  int a[n+1];
  for(int i = 0;i<n;i++){
    cin>>a[i];
  
  }
  int x = -1;
  for(int i = 0;i<n-1;i++){
    if(a[i]+a[i+1] >= l)
      x = i;
  }
  if(x == -1){
    cout<<"Impossible"<<endl;
    return 0;
  }
  
  cout<<"Possible"<<endl;
  for(int i = 0;i<x;i++){
    cout<<i+1<<endl;
  }
  for(int i = n-2;i>=x;i--){
    cout<<i+1<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 1152
a, b = map(int, input().split())
def f(x):
    if (x + 1) % 4 == 0:
        return 0
    elif (x + 1) % 4 == 1:
        return x
    elif (x + 1) % 4 == 2:
        return x ^ (x - 1)
    else:
        return x ^ (x - 1) ^ (x - 2)
print(f(b) ^ f(a - 1))

Measured memory_bytes: 3060
N=int(input())
T=[]
I=input()
I=I.split(" ")
for i in I:
    T.append(int(i))

minimum=1000000
sum_1=0
sum_2=0
for i in range(0,N):
    for j in range(0,N):
        if (j<=i):
            sum_1+=T[j]
        else:
            sum_2+=T[j]
    candidate=abs(sum_1-sum_2)
    if(candidate<minimum):
        minimum=candidate
    sum_1=0
    sum_2=0
print(minimum)

Measured memory_bytes: 3064
MOD = 10**9 + 7
def mod_pow(p, q):
    res = 1
    while q:
        if q & 1:
            res = (res * p) % MOD
        p = (p * p) % MOD
        q //= 2
    return res

def inv(p):
    return mod_pow(p, MOD-2)

def mod_comb(p, q):
    a, b = 1, 1
    for i in range(q):
        a = (a * (p-i)) % MOD
        b = (b * (i+1)) % MOD
    return (a * inv(b)) % MOD

def solve(n, a, b):
    res = mod_pow(2, n)
    for x in [0, a, b]:
        res = (res - mod_comb(n, x)) % MOD
    return res

n, a, b = map(int, input().split())
print(solve(n, a, b))

Measured memory_bytes: 3064
(defun input (n)
  (let ((a (make-array (1+ n))))
    (loop for i from 1 to n do (setf (aref a i) (read)))
    a)) 
(let* ((n (read))
       (a (input n))
       (r (make-array (+ n 2)))
       (l (make-array (+ n 2))))
  (setf (aref l n) (aref a n))
  (loop for i from 1 below n
    do (setf (aref r i) (gcd (aref r (1- i)) (aref a i))))
  (loop for i from n downto 1
    do (setf (aref l (1- i)) (gcd (aref l i) (aref a (1- i)))))
  (format t "~A~%"
          (loop for i from 1 to n
                maximize (gcd (aref r (1- i)) (aref l (1+ i))))))

Measured memory_bytes: 59748
#include <iostream>
using namespace std;
int n,m,p,sum,ans;
int x[101];
int main(){
	while(1){
		cin >> n>>m >>p;
		if(n==0&&m==0&&p==0)break;
		sum=0;
		for(int i=1;i<=n;i++){
			cin >>x[i];
			sum+=x[i];
		}
		if(x[m]==0){
			ans=0;
		}else{
			ans=sum*(100-p)/x[m];
		}
		cout <<ans <<endl;
	}
	return 0;
}

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

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 924844033;
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
const ll B = 3597;
const int MAXN = 220000;

int was[MAXN];
int c[MAXN];
ll a[1 << 19];
ll b[1 << 19];
ll fc[MAXN];
ll bfc[MAXN];
vector<int> eds[MAXN];
int sz[MAXN];
int n;

void dfs1(int v) {
	sz[v] = 1;
	was[v] = 1;
	for (int u: eds[v]) {
		if (was[u])
			continue;
		dfs1(u);
		sz[v] += sz[u];
		++c[sz[u]];
	}
	if (sz[v] != n)
		++c[n - sz[v]];
}

int rev(int x, int k) {
	int ans = 0;
	for (int i = 0; i < k; ++i) {
		ans = ans * 2 + (x & 1);
		x >>= 1;
	}
	return ans;
}

void fft(ll *a, int k, int inv) {
	int n = (1 << k);
	for (int i = 0; i < n; ++i) {
		int x = rev(i, k);
		if (x > i)
			swap(a[x], a[i]);
	}
	for (int bl = 1; bl < n; bl *= 2) {
		ll wadd = pw(B, (1 << 20) / bl);
		if (inv)
			wadd = pw(wadd, MOD - 2);
		for (int i = 0; i < n; i += 2 * bl) {
			ll w = 1;
			for (int j = i; j < i + bl; ++j, w = (w * wadd) % MOD) {
				ll u = a[j];
				ll v = a[j + bl] * w % MOD;
				a[j] = (u + v) % MOD;
				a[j + bl] = (u - v + MOD) % MOD;
			}
		}
	}
	if (inv) {
		ll n2 = pw(n, MOD - 2);
		for (int j = 0; j < n; ++j)
			a[j] = (a[j] * n2) % MOD;
	}
}

int main() {
	scanf("%d", &n);
	fc[0] = bfc[0] = 1;
	for (int i = 1; i <= n; ++i)
		fc[i] = (fc[i - 1] * i) % MOD, bfc[i] = pw(fc[i], MOD - 2);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a, --b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	dfs1(0);
	for (int i = 0; i <= n; ++i)
		a[i] = (c[i] * fc[i]) % MOD;
	for (int i = 0; i <= n; ++i)
		b[i] = bfc[n - i];
	int k = 0;
	while ((1 << k) <= 2 * n)
		++k;
	fft(a, k, 0);
	fft(b, k, 0);
	for (int i = 0; i < (1 << k); ++i)
		a[i] = (a[i] * b[i]) % MOD;
	fft(a, k, 1);
	for (int i = 1; i <= n; ++i) {
		a[i] = a[i + n] * bfc[i] % MOD;
		ll go = fc[n] * bfc[i] % MOD * bfc[n - i] % MOD * n % MOD;
		go = (go - a[i] + MOD) % MOD;
		printf("%lld\n", go);
	}
	return 0;
}




Measured memory_bytes: 35456
N , M = map(int,input().split())
C = list(map(int,input().split()))

G = [[0]*(N+1) for _ in range(M+1)]

for i in range(N+1):
    G[0][i] = 1000000

for kinds in range(1,M+1):
    for kingaku in range(1,N+1):
        if kingaku-C[kinds-1]<0:
            G[kinds][kingaku] = G[kinds-1][kingaku]
            continue
        #print('\n')
        #print(f'kingaku:{kingaku}, kinds:{kinds}')
        #print(G[kinds-1][kingaku])
        #print(G[kinds][kingaku-C[kinds-1]]+1)
        G[kinds][kingaku] = min(G[kinds-1][kingaku], G[kinds][kingaku-C[kinds-1]]+1)
        #print(f'index{kinds},{kingaku}')
        #print(G[kinds][kingaku])

#print(G)
print(G[M][N])




Measured memory_bytes: 43736
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<int>>C(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>C[i][j];
    }
  }
  int b21=C[0][1]-C[0][0];
  int b32=C[0][2]-C[0][1];
  int b31=C[0][2]-C[0][0];
  bool flag=true;
  if(b21!=C[1][1]-C[1][0]||b21!=C[2][1]-C[2][0]){
    flag=false;
  }
  if(b32!=C[1][2]-C[1][1]||b32!=C[2][2]-C[2][1]){
    flag=false;
  }
  if(b31!=C[1][2]-C[1][0]||b31!=C[2][2]-C[2][0]){
    flag=false;
  }
  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
  


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

char s[1000005];
int main()
{
    scanf("%s", s);
    int L = strlen(s);
    long long Sol = 0;
    for(char c = 'a'; c <= 'z' ; ++c){
        int nr = 0;
        for(int i = L - 1; i >= 0 ; --i){
            if(s[i] == c) Sol = Sol + nr;
            else ++nr;
        }
    }
    printf("%lld", Sol + 1);
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cctype>
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define sort_all(v) sort(v.begin(), v.end())
#define fill(a) memset(a, 0, sizeof(a))

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define FOR_REV(i, a ,b) for(int i = a; i >= b; i--)
#define REP(i, n) FOR(i, 0, n)


void test() {
    string s, t;
    cin >> s >> t;
    int ans = INF;
    for(size_t i = 0; i <= s.size() - t.size(); i += 1) {
        int count = 0;
        for(size_t j = 0; j < t.size(); j++) {
            if(t[j] != s[i+j]) {
                count++;
            }
        }
        ans = min(ans, count);
    }
    cout << ans;
}   
 
int main ()     
{
    // int t;
    // cin >> t;
    // while(t--) 
        test();
}


Measured memory_bytes: 3560
a = input()
b = input()
c = input()
q = a[0]
a = a[1:]

while 1:
	if q == 'a':
		if len(a)== 0:
			print('A')
			exit()
		q = a[0]
		a = a[1:]
	elif q == 'b':
		if len(b) == 0:
			print('B')
			exit()
		q = b[0]
		b = b[1:]
	elif q == 'c':
		if len(c) == 0:
			print('C')
			exit()
		q = c[0]
		c = c[1:]




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }
 
int main(){
    ll N;
    cin >> N;
    string res = "Yes";
    map<string, bool> M;
    string preW = "-1";
    REP(i, N) {
        string W;
        cin >> W;
        if (M.count(W) != 0) res = "No";
        if (W.size() > 10) res = "No";
        REP(j, W.size()) if (isupper(W[j])) res = "No";
        if (preW != "-1") {
            if (preW[preW.size()-1] != W[0]) res = "No";
        }
        M[W] = true;
        preW = W;
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
/*
 * Author:heroming
 * File:heroming.cpp
 * Time:2017/01/07 08:21:17
 */
#include <vector>
#include <list>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <string>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <unordered_map>
using namespace std;

#define px first
#define py second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define clr(v, e) memset(v, e, sizeof(v))
#define rep(it, v) for (auto it : v)
#define forn(i, n) for (int i = 0; i < (n); ++ i)
#define rforn(i, n) for (int i = (n) - 1; i >= 0; -- i)
#define form(i, a, b) for (int i = (a); i <= (b); ++ i)
#define rform(i, a, b) for (int i = (b); i >= (a); -- i)
#define forv(i, v) for (int i = 0; i < sz(v); ++ i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++ it)

typedef long long lint;
typedef vector<int> vint;
typedef vector<string> vstring;
typedef pair<int, int> pint;
typedef vector<lint> vlint;
typedef vector<pint> vpint;

const int maxn = 110;
const int maxm = 1010;
const int inf = 10001000;

int n, m;
int dis[maxn][maxn];
int u[maxm], v[maxm], w[maxm];

int main() {
    while (scanf("%d%d", &n, &m) != EOF) {
        form (i, 1, n) form (j, 1, n) dis[i][j] = (i == j ? 0 : inf);
        forn (i, m) {
            scanf("%d%d%d", &u[i], &v[i], &w[i]);
            dis[u[i]][v[i]] = dis[v[i]][u[i]] = w[i];
        }
        form (k, 1, n) form (i, 1, n) form (j, 1, n) {
            if (dis[i][k] + dis[k][j] < dis[i][j]) {
                dis[i][j] = dis[i][k] + dis[k][j];
            }
        }
        int ans = 0;
        forn (i, m) {
            if (dis[u[i]][v[i]] < w[i]) ++ ans;
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;
int h, w, k;

int calc(vector<string> &g, int y, int x)
{
    int ret = 0;
    rep(i, h)
    {
        if ((y >> i) & 1)
        {
            continue;
        }
        rep(j, w)
        {
            if ((x >> j) & 1)
            {
                continue;
            }
            if (g[i][j] == '#')
                ret++;
        }
    }
    return ret;
}
int main()
{

    cin >> h >> w >> k;
    vector<string> g(h);
    rep(i, h)
    {
        cin >> g[i];
    }
    int ans = 0;
    rep(i, 1 << h)
    {
        rep(j, 1 << w)
        {
            if (calc(g, i, j) == k)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
x = int(input())

divisors = []
for i in range(1, int(x**0.5)+1):
  if x % i == 0:
    divisors.append(i)
    if i != x // i:
      divisors.append(x//i)

boption = []
a = 1
while boption == []:
  for i in divisors:
    b = a - i
    if a**5-b**5 == x:
      boption.append(b)
  a += 1

a -= 1
print("{} {}".format(int(a),int(boption[0])))

Measured memory_bytes: 9380
def main():
    s = input()
    a=s[:2]
    b=s[2:]
    if (a=="00" or 12<int(a)<100) and (1<= int(b)<=12):
        print("YYMM")
    elif (1<= int(a)<=12) and (b=="00" or 12<int(b)<100):
        print("MMYY")
    elif ((1<= int(a)<=12) and (0<=int(b)<13) )or ((1<= int(b)<=12) and (0<=int(a)<13)):
        print("AMBIGUOUS")
    else:
        print("NA")
main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using lli =  long long int ; using namespace std;
bool isprime(lli n); lli gcd(lli a, lli  b);
lli lcm(lli n, lli m); lli fact(lli n);
double dgr(double a); int fixMod(int a, int b);
long long  ncr(int n, int r); void fast();
int main() {
	fast();
	lli a, p; cin >> a >> p;
	cout << (a * 3 + p) / 2 << endl;
}
void fast() { ios::sync_with_stdio(false); cin.tie(0);// cout.tie(0);
#ifndef ONLINE_JUDGE //freopen("input.in", "r", stdin); //freopen("output.out", "w", stdout);
#endif 
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

score = sum(B)
for ix in range(1, N):
    if (A[ix-1] + 1 == A[ix]):
        # print(A[ix-1], ":", A[ix]," +=", C[A[ix-1]-1])
        score += C[A[ix-1]-1]

print(score)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#define eps (1e-10)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
class Point{
    public:
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){}
    Point operator -(Point p){
        return Point(x-p.x,y-p.y);
    }
    Point operator +(Point p){
        return Point(x+p.x,y+p.y);
    }
    Point operator *(double k){
        return Point(x*k,y*k);
    }
    Point operator /(double k){
        return Point(x/k,y/k);
    }
    Point operator == (Point p){
        return equals(x,p.x)&&equals(y,p.y);
    }
    Point operator <(Point p){
        return !equals(x,p.x)?(x-p.x)<eps:(y,p.y)<eps;
    }
    Point operator > (Point p){
        return !equals(x,p.x)?(x-p.x)>eps:(y,p.y)>eps;
    }
};
typedef Point Vector;
struct segment{
    Point p1,p2;
};
typedef segment line;
struct circle{
    Point c;
    double r;
};
typedef vector<Point>polygon;
double norm(Vector V){
    return V.x*V.x+V.y*V.y;
}
double abs(Vector V){
    return sqrt(norm(V));
}
double dot(Vector V1,Vector V2){
    return V1.x*V2.x+V1.y*V2.y;
}
double cross(Vector V1,Vector V2){
    return V1.x*V2.y-V1.y*V2.x;
}
bool isprallel(Vector V1,Vector V2){
    if(cross(V1,V2)==0)return true;
    else return false;
}
bool isorthogonal(Vector V1,Vector V2){
    if(dot(V1,V2)==0)return true;
    else return false;
}
Point projection(segment s,Point p){
    Vector hypo,base;
    hypo=p-s.p1;
    base=s.p2-s.p1;
    double r=dot(hypo,base)/norm(base);
    return s.p1+base*r;
}
Point reflection(segment s,Point p){
    return p+(projection(s,p)-p)*2.0;
}
double getdistance(Point a,Point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double distancepl(Point p,line l){
    return abs(cross(p-l.p1,l.p2-l.p1)/abs(l.p2-l.p1));
}
double distanceps(Point p,segment s){
    if(dot(s.p2-s.p1,p-s.p2)>=0)return getdistance(p,s.p2);
    else if(dot(s.p2-s.p1,p-s.p1)>=0)return getdistance(p,s.p1);
    else return distancepl(p,s);
}
double distancess(segment s1,segment s2){
    return min(min(distanceps(s1.p1,s2),distanceps(s1.p2,s2)),min(distanceps(s2.p1,s1),distanceps(s2.p2,s1)));
}
int main(){
    int q;
    Point p1,p2,p,ans;
    segment s;
    cin>>p1.x>>p1.y>>p2.x>>p2.y;
    s.p1=p1;
    s.p2=p2;
    cin>>q;
    while(q--){
        cin>>p.x>>p.y;
        ans=projection(s,p);
        printf("%.10lf %.10lf\n",ans.x,ans.y);
    }
}



Measured memory_bytes: 3204
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int func(int n){
  if(n % 2 == 0)
    return n / 2;
  else
    return n * 3 + 1; 
}

int main() {
  int n, T;
  cin >> n >> T;
  int res = INF;
  rep(i, n){
    int c, t;
    cin >> c >> t;
    if(t > T) continue;
    chmin(res, c);
  }
  if(res == INF) cout << "TLE" << ln;
  else cout << res << ln;
  }


Measured memory_bytes: 256
// A, B, C
// B+C, C+A, A+B  (B-A)
// 2A+B+C, 2B+C+A, 2C+A+B (A-B)
// 2A+3B+3C, 2B+3C+3A, 2C+3A+3B (B-A)
// 6A+5B+5C, 6B+5C+5A, 6C+5A+5B (A-B)
// 10A+11B+11C, 10B+11C+11A, 10C+11A+11B (B-A)
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 C = sc.nextInt();
    long K = sc.nextLong();
    System.out.println(K%2 == 0 ? A-B : B-A);
  }
}

Measured memory_bytes: 22868
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		int len = s.length();
		int cnt0 = 0;
		for (int i = 0; i < len; i++) {
			if (s.charAt(i) == '0') {
				cnt0++;
			}
		}
		int cnt1 = len - cnt0;
		System.out.println(len - Math.abs(cnt0 - cnt1));
	}
}


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

using namespace std;
typedef long long ll;

int main() {
    int n;
    scanf("%d", &n);
    ll res = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) continue;
        res += i;
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1005;
char in[maxn][maxn];
bool used[maxn][maxn];
int main() {
    int h, w;
    cin >> h >> w;
    memset(used, 0, sizeof(used));
    queue<pair<int, int>> q;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> in[i][j];
            if (in[i][j] == '#') {
                q.push({i, j});
                used[i][j] = true;
            }
        }
    }
    int ans = 0;
    while (!q.empty()) {
        int sz = q.size();
        for (int i = 0; i < sz; i++) {
            auto top = q.front();
            q.pop();
            int row = top.first;
            int col = top.second;
            int d[4][4] = {{0, 1}, {0, -1}, {1, 0}, {-1,0}};
            for (int i = 0; i < 4; i++) {
                int nrow = row + d[i][0];
                int ncol = col + d[i][1];
                if (nrow < 0 || nrow >= h) continue;
                if (ncol < 0 || ncol >= w) continue;
                if (used[nrow][ncol]) continue;
                used[nrow][ncol] = true;
                q.push({nrow, ncol});
            }
        }
        ans++;
    }
    cout << max(ans - 1, 0) << "\n";
    return 0;
}


Measured memory_bytes: 10384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = ReadString();
            bool[] filter = new bool['z' - 'a' + 1];
            S.ForEach(val => filter[val - 'a'] = true);
            for (int i = 0; i < filter.Length; i++)
            {
                if (!filter[i])
                {
                    Out((char) (i + 'a'));
                    return;
                }
            }

            Out("None");
        }

        //最小公倍数
        static int LCM(int num1, int num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        static long LCM(long num1, long num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        //最大公約数
        static int GCD(int num1, int num2)
        {
            int a = Math.Max(num1, num2);
            int b = Math.Min(num1, num2);
            int mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static long GCD(long num1, long num2)
        {
            long a = Math.Max(num1, num2);
            long b = Math.Min(num1, num2);
            long mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static void Out(object o)
        {
            Console.WriteLine(o);
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }

    class PriorityQueue<T>
    {
    }
}

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

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

    long N, M;
    cin >> N >> M;

    long L_max = 0, R_min = N;
    long L, R;

    for (long m = 0; m < M; m++)
    {
        cin >> L >> R;
        if (L > L_max)
        {
            L_max = L;
        }
        if (R < R_min)
        {
            R_min = R;
        }
    }

    if (R_min - L_max + 1 > 0)
    {
        cout << R_min - L_max + 1 << '\n';
    }
    else
    {
        cout << 0 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<ctime>
#include<map>
#include<typeinfo>
#define R(i, n) for(int i = 0;i < n; i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define SL(a) scanf("%lld", &a)
#define SL2(a, b) scanf("%lld%lld", &a, &b)
#define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define SA(i, n, a) R(i, n) scanf("%d", &a[i])
#define SAL(i, n, a) R(i, n) scanf("%lld", &a[i])
#define SC(a) scanf("%c", &a)
#define P(a) printf("%d", a)
#define PL(a) printf("%lld", a)
#define PY printf("YES")
#define PN printf("NO")
#define Py printf("Yes")
#define Pn printf("No")
using namespace std;
using ll = long long;
using PR = pair<int, int>;
const ll MOD = 1e+9 + 7;
const int INF = 1e+9;
const double PI = acos(-1);

int A, B, C;

int main(){
	S3(A, B, C);
	for (int i = 1; i <= B; i++) {
		if (A * i % B == C) {
			PY;
			return 0;
		}
	}
	PN;
} 

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

using ll = long long;
const ll mod = 1000000007;

int main() {
	int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	vector<ll> po, ne;
	int z = 0;

	for (int i = 0; i < n; ++i) {
		if (a[i] < 0) ne.push_back(a[i]);
		else if (a[i] > 0) po.push_back(a[i]);
		else z++;
	}

	int sp = po.size();
	int sn = ne.size();

	bool fu = false;
	if (n == k) fu = (sn % 2 == 1);
	else if (sn == n) fu = (k % 2 == 1);

	ll ans = 1;
	if (fu) {
		sort(a.begin(), a.end(), [&](ll v1, ll v2) {
			if (abs(v1) < abs(v2)) return true;
			else return false;
		});
		for (int i = 0; i < k ; i++) ans = ans * abs(a[i]) % mod;
		ans = mod - ans;
	}
	else {
		sort(a.begin(), a.end(), [&](ll v1, ll v2) {
			if (abs(v1) > abs(v2)) return true;
			else return false;
		});

		int cn = 0;
		for (int i = 0; i < k; i++) if (a[i] < 0) cn++;

		if (cn % 2 == 0) {
			for (int i = 0; i < k; i++) ans = ans * abs(a[i]) % mod;
		} 
		else {
			int lp = -1, ln = -1, np = -1, nn = -1;
			for (int i = k - 1; i >= 0; i--) if (a[i] >= 0) {lp = i; break;}
			for (int i = k - 1; i >= 0; i--) if (a[i] < 0) {ln = i; break;}
			for (int i = k; i < n; i++) if (a[i] >= 0) {np = i; break;}
			for (int i = k; i < n; i++) if (a[i] < 0) {nn = i; break;}
			if (lp != -1 && np != -1 && ln != -1 && nn != -1) {
				if (abs(a[lp]) * abs(a[np]) < abs(a[ln]) * abs(a[nn])) {
					swap(a[lp], a[nn]);
				}
				else {
					swap(a[ln], a[np]);
				}
			}
			else if (lp != -1 && nn != -1) swap(a[lp], a[nn]);
			else swap(a[ln], a[np]);

			for (int i = 0; i < k; i++) ans = ans * abs(a[i]) % mod;
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6876
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    ll x,a=100;cin>>x;
    ll c=0;
    while(a<x){
        a+=a/100;
        c++;
    }
    cout<<c;
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int main()
{

    int n;
    cin>>n;
    vi a(n);
    vpi p;
    forn(i,0,n) {
        cin>>a[i];
        p.pb(mp(a[i]-1, i+1));
    }
    sort(all(p));
    int last = -1;
//    int space = 0;
    deque<int> space;
    vi trash;
    vi ans(n*n, -1);
    forn(i,0,n) {
        if(i>0 && p[i].first == p[i-1].first) {
            cout<< "No";
            return 0;
        }
        int fill = p[i].first - last - 1;
        forn(pos,last+1,p[i].first) space.pb(pos);
        int k = p[i].second;
        if(space.size() < k-1) {
            cout<< "No";
            return 0;
        }
        forn(j,0,k-1) {
            ans[space.front()] = k;
            space.pop_front();
        }
        last = p[i].first;
        ans[p[i].first] = k;
    }
    space.clear();
    last = n*n;
    for(int i = n-1; i >=0; i--) {
        int fill = -p[i].first + last - 1;
        for(int pos = last-1; pos > p[i].first; pos--) if(ans[pos]==-1) space.pb(pos);
        int k = n-p[i].second;
        if(space.size() < k) {
            cout<< "No";
            return 0;
        }
        forn(j,0,k) {
            ans[space.front()] = n-k;
            space.pop_front();
        }
        last = p[i].first;
    }
    printf("Yes\n");
    forn(i,0,n*n) {
        printf("%d ", ans[i]);
    }
    
}



Measured memory_bytes: 2944
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	string s,t;
	cin >> s >> t;

	int n = s.size();

	for (int i = 0; i < n; i++) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
	
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N;
string S;


signed main(){
    cin >> N;
    cin >> S;

    int ans = 0;
    rep(a, 0, 10) rep(b, 0, 10) rep(c, 0, 10){
        string s(3, ' ');
        s[0] = a+'0';
        s[1] = b+'0';
        s[2] = c+'0';
        bool f[3] = { false, false, false };
        int j = 0;
        rep(i, 0, N) if(S[i] == s[0]){ j = i, f[0] = true; break; }
        rep(i, j+1, N) if(S[i] == s[1]){ j = i, f[1] = true; break; }
        rep(i, j+1, N) if(S[i] == s[2]){ j = i, f[2] = true; break; }
        if(f[0] and f[1] and f[2]) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if(b%a == 0) cout << a + b << endl;
    else cout << b-a << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a<=b)
       cout <<  a << endl;
    else 
       cout << a-1 <<endl; 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		 int N = sc.nextInt();
	     double sum = 0;
	     Integer A[] = new Integer[N];
			for (int i=0; i<N; i++) {
				A[i] = sc.nextInt();
				sum += 1.0 / A[i];
			}
			
		 System.out.println(1.0 / sum);
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
    IO_OP;
    
    int a, b;
    cin >> a >> b;
    if(a <= 0 && b >= 0) cout << "Zero" << endl;
    else if(a > 0) cout << "Positive" << endl;
    else if((b-a)&1) cout << "Positive" << endl;
    else cout << "Negative" << endl;
     

}

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

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

    if(X%7==0){
        cout << "thu" << endl;
    }else if(X%7==1){
        cout << "fri" << endl;
    }else if(X%7==2){
        cout << "sat" << endl;
    }else if(X%7==3){
        cout << "sun" << endl;
    }else if(X%7==4){
        cout << "mon" << endl;
    }else if(X%7==5){
        cout << "tue" << endl;
    }else if(X%7==6){
        cout << "wed" << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#include<stdio.h>
int main(){
  int i,j,H,W;
  
  while(1){

    scanf("%d %d",&H,&W);

    if(H == 0 && W == 0){
      break;}
    for(i = 0; i < H; i++){

      for(j = 0; j < W; j++){

	if(i == 0 || i == H - 1) printf("#");

	else if(j == 0 || j == W-1 )printf("#");

	else printf(".");

      }printf("\n");	
    }

    printf("\n");
  }
  

  return 0;
}



Measured memory_bytes: 2060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    for(int i = 0; i < n; ++i) cin >> s.at(i);
    sort(s.begin(), s.end());
    vector<pair<int, string>> p;
    int cnt = 1;
    for(int i = 1; i < n; ++i){
        if(s.at(i) == s.at(i - 1) && i != n - 1) cnt++;
        else if(s.at(i) != s.at(i - 1) && i != n - 1){
            p.push_back(make_pair(cnt, s.at(i - 1)));
            cnt = 1;
        }
        else if(s.at(i) == s.at(i - 1) && i == n - 1){
            cnt++;
            p.push_back(make_pair(cnt, s.at(i)));
        }
        else if(s.at(i) != s.at(i - 1) && i == n - 1){
            p.push_back(make_pair(cnt, s.at(i - 1)));
            cnt = 1;
            p.push_back(make_pair(cnt, s.at(i)));
        }
    }
    if(p.size() == 1) cout << p.at(0).second << endl; 
    else{
        sort(p.rbegin(), p.rend());
        int mx = p.at(0).first, i = 0;
        vector<string> ans;
        while(i < p.size() && p.at(i).first == mx){
            ans.push_back(p.at(i).second);
            i++;
        }
        sort(ans.begin(), ans.end());
        for(int i = 0; i < ans.size(); ++i) cout << ans.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 31656
#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 x;
    cin >> x;
    bool flag;

    while(1){
        flag = true;
        for(int i = 2; i < x; i++){
            if(x % i == 0){
                flag = false;
                break;
            }
        }
        if(flag) break;
        x++;
    }
    cout << x << endl;
    return 0;
}

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

int main() {
    int n,q;
    cin >> n >> q;
    vector<long long int> A[n];
    for(int i = 0; i < q; i++) {
        int command;
        cin >> command;
        if(command == 0) {
            int t, x;
            cin >> t >> x;
            A[t].push_back(x);
        } else if(command == 1) {
            int t;
            cin >> t;
            for(int i = 0; i < A[t].size(); i++) {
                cout << A[t][i];
                if(i != A[t].size() - 1) {
                    cout << " ";
                }
            }
            cout << endl;
        } else {
            int t;
            cin >> t;
            A[t].clear();
        }
    }
    return 0;
}


Measured memory_bytes: 8872
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

int main() {
  string in(S);
  string in(T);

  int N = S.size();

  rep(i, N)
    if (S[i] != T[i]) {
      cout << "No\n";
      return 0;
    }
  cout << "Yes\n";

  return 0;
}


Measured memory_bytes: 3628