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

import java.io.*;
import java.util.*;
import java.util.PriorityQueue;

public class Main {
	public static long gcd(long n, long m){ if(m > n) return gcd(m,n); if(m == 0) return n; return gcd(m, n%m);}
	public static long lcm(long m, long n){ return (m/gcd(m,n))*n;}
	static int mod = 1000000007;
	static int INF = Integer.MAX_VALUE;
	static int[] dx = {0,0,1,-1};
	static int[] dy = {1,-1,0,0};
	static int[] dx8 = {0,0,1,-1,1,1,-1,-1};
	static int[] dy8 = {1,-1,0,0,1,-1,-1,1};
	public static void main(String[] args){
		FastScanner scanner = new FastScanner();
		int k = scanner.nextInt();
		String s = "";
		for(int i = 0; i < k; i++){
			s += "ACL";
		}
		System.out.println(s);
	}
	private static class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
				if (ptr < buflen) {
						return true;
				}else{
						ptr = 0;
						try {
								buflen = in.read(buffer);
						} catch (IOException e) {
								e.printStackTrace();
						}
						if (buflen <= 0) {
								return false;
						}
				}
				return true;
		}
		private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
		private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
		public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
		public String next() {
				if (!hasNext()) throw new NoSuchElementException();
				StringBuilder sb = new StringBuilder();
				int b = readByte();
				while(isPrintableChar(b)) {
						sb.appendCodePoint(b);
						b = readByte();
				}
				return sb.toString();
		}
		public long nextLong() {
				if (!hasNext()) throw new NoSuchElementException();
				long n = 0;
				boolean minus = false;
				int b = readByte();
				if (b == '-') {
						minus = true;
						b = readByte();
				}
				if (b < '0' || '9' < b) {
						throw new NumberFormatException();
				}
				while(true){
						if ('0' <= b && b <= '9') {
								n *= 10;
								n += b - '0';
						}else if(b == -1 || !isPrintableChar(b)){
								return minus ? -n : n;
						}else{
								throw new NumberFormatException();
						}
						b = readByte();
				}
		}
		public int nextInt() {
				long nl = nextLong();
				if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
				return (int) nl;
		}
		public double nextDouble() { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 36288
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;

    vector<bool> is_prime(55556, true);
    vector<ll> primes; primes.reserve(50000);
    REP(i, 55556) {
        if (i < 2) {
            is_prime[i] = false;
            continue;
        }
        if (is_prime[i]) {
            primes.push_back(i);
            for (ll j = i*2; j <= 55555; j += i) {
                is_prime[j] = false;
            }
        }
    }
    
    vector<ll> x; x.reserve(2000);
    copy_if(ALL_OF(primes), back_inserter(x), [](ll i) { return i % 10 == 9; });
    REP(i, n) cout << x[i] << " \n"[i==i_len-1];

}

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();
		int Q = sc.nextInt();
		String S = sc.next();
		
		int sum [] = new int [N+2];
		
		int j=0;
		int count=0;
		
		while (j<N){
			if (S.charAt(j)!='A'){
				sum [j+1]=count;
				j++;
			}
			else {
				sum [j+1]=count;
				if (j<N-1 && S.charAt(j+1) =='C'){
					count++;
					sum [j+2]=count;
					j++;
				}
				else {
					sum [j+2]=count;
					j++;
				}
			}
		}
		/*for (int i=1; i<N+1; i++){
			System.out.println("index= "+i+" , value = "+sum[i]);
		}*/
		
		
		for (int i=0; i<Q; i++){
			int l = sc.nextInt();
			int r = sc.nextInt();
			
			System.out.println(sum[r]-sum[l]);
			
		}
		
		sc.close();
	}
}


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

int main() {
    int N;
    cin >> N;
    vector<string>S(N);
    map<string,int>Map;
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cin >> S[i];
        Map[S[i]]++;
        cnt = max(cnt,Map[S[i]]);
    }
    sort(S.begin(),S.end());
    for(int i = 0; i < N; i++) {
        if(Map[S[i]] == cnt) {
            cout << S[i] << endl;
            Map[S[i]]--;
        }
    }
}

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

int main() {
	cin.tie(nullptr) -> sync_with_stdio(false);
    i64 n; cin >> n;
	map<int,int> m;
    i64 sum = 0;
    for(i64 i=0; i<n; i++){
        int x; cin >> x;
        m[x]++;
        sum += x;
    }
    int Q; cin >> Q;

	
	while(Q--){
		int b,c; cin >> b >> c;
    	sum += (c-b)*m[b];
   	 	m[c] += m[b];
    	m[b] = 0;
    	cout<< sum;
		cout<<'\n';
	}
}

Measured memory_bytes: 7992
#!/usr/bin/env ruby
require 'set'

n = gets.chomp.to_i

dict = Set.new
n.times do
  action, str = gets.chomp.split
  str = str.tr('ACTG', '1234').to_i
  if action == 'insert'
    dict << str
  else
    puts dict.include?(str) ? 'yes' : 'no'
  end
end

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

int main(){
   int a,b;
   char op;
   
   while(1){
       cin >> a >> op >> b;
       if(op == '?') return 0;
       switch(op){
           case '*': a = a * b;
            break;
           case '/': a = a / b;
            break;
           case '+': a = a + b;
            break;
           case '-': a = a - b;
     
   }
   cout << a << endl;
   }
 return 0;   
}

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


int main() {
    ll N, K; cin >> N >> K;
    vector<ll> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];
    sort(H.begin(), H.end());
    if (N <= K) {cout << 0 << endl; return 0;}
    for (int i = 0; i < K; ++i) H.pop_back();
    ll sum = 0;
    for (auto& n : H) sum += n;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define mp make_pair
// GCD inbuilt func: __gcd(a,b)
// LCM formula: (a*b)/__gcd(a,b)

int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
	// CODE goes here
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max({a*c,a*d,b*c,b*d});
	return 0;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<string.h>
int main()
{
	int i,j,l,c=0,d=0,m,k;
	char s[1000],t[1000];
	scanf("%s",s);
	scanf("%s",t);
	l=strlen(s),m=strlen(t);
	for(i=0;i<l-(m-1);i++)
	{
		for(j=0,k=i;j<m;j++,k++)
		{
			if(s[k]==t[j])d++;
		}
		if(d>c)c=d;
		d=0;
	}
	printf("%d",m-c);
}

Measured memory_bytes: 1736
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = input()

ans = 0
i = 1

while 2*i - 1 < len(N):
  ans += 10**(2*i-1) - 10**(2*i-2)
  i += 1

if len(N)%2 == 0:
  print(ans)
else:
  print(ans + int(N) - 10**(len(N)-1) + 1)

Measured memory_bytes: 5200
#include<bits/stdc++.h>
const int maxn = 300200;
const int mod = 998244353;
typedef long long ll;
inline ll pow(ll a,int b,ll ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1) ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
inline void reduce(int & x){ x += x >> 31 & mod; }
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
int sum;
int n, a[maxn];
int a0[maxn], a1[maxn];
int s0[maxn];
inline void output(int x) { std::cout << x << ' ' << sum - x << '\n', exit(0); }
inline bool ok(int x) {
	int k = 0;
	for(int i = 2;i <= n;i += 2) if(s0[i - 1] - k >= x) k = std::min(k, s0[i]);
	return s0[n] - k >= x;
}
int main() {
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	for(int i = 1;i <= n;++i){
		std::cin >> a[i], sum += a[i];
		a0[i] = a0[i - 1];
		a1[i] = a1[i - 1];
		i[i & 1 ? a0 : a1] += a[i];
	}
	if(n % 2 == 0) output(std::max(a0[n], a1[n]));
	for(int i = 1;i <= n;++i) s0[i] = s0[i - 1] + (i & 1 ? a[i] : -a[i]);
	int l = 0,r = 1e9;
	for(;l + 1 != r;) {
		int mid = l + r >> 1;
		(ok(mid) ? l : r) = mid;
	}
	output(a1[n] + l);
}


Measured memory_bytes: 4992
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    tmp_a, tmp_b = map(int, input().split())
    a.append(tmp_a)
    b.append(tmp_b)

dp = [[float('inf')] * (h+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(h+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(j+a[i], h)] = min(dp[i+1][min(j+a[i], h)], dp[i+1][j] + b[i])

print(dp[n][h])

Measured memory_bytes: 289928
N = int(input())
L = [list(map(int,input().split())) for i in range(N)]

L = sorted(L)

D = {}

for i in range(N-1) :
    ax,ay = L[i]
    for j in range(i+1,N) :
        bx,by = L[j]
        
        p = bx - ax
        q = by - ay
        
        k = str(p)+str(q)
        
        if k not in D :
            D[k] = 1
        else :
            D[k] += 1

if len(D) == 0 :
    ans = 1
else :
    ans = N - max(D.values())

print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include<vector>
#define MAXN 100001

using namespace std;

int a[MAXN];

int main()
{
    int N;
    scanf("%d",&N);
    int count2=0,count4=0;
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
        if(a[i]%2==0&&a[i]%4!=0)
            count2++;
        if(a[i]%4==0)
            count4++;
    }
    if((3+(count4-1)*2)>=(N-(count2/2*2)))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
    
    char a[11],b[11],c[11];
    
    scanf( "%s %s %s",a,b,c );
    
    a[0] = a[0] - 32;
    b[0] = b[0] - 32;
    c[0] = c[0] - 32;
    
    printf( "%c%c%c",a[0],b[0],c[0] );
    
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(K: int):
    a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(a.pop(K-1))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


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

int main()
{
    ll a,b,c;
    while(cin>>a>>b>>c)
    {
        if(a>=c)
            a-=c;
        else if((a+b)>=c)
        {
            b=a+b-c;
            a=0;
        }
        else if((a+b)<c)
        {
            a=0;
            b=0;
        }
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

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


using namespace std;



int main() {

	int a;
	string p;
	cin >> a >> p;
	if (a >= 3200)cout << p << endl;
	else cout << "red" << endl;
	
	return 0;


}

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



int main() {
  int N,T;
  cin>>N>>T;
  vector<vector<int>> food(N,vector<int>(2));
  rep(i,N){
      cin>>food.at(i).at(0)>>food.at(i).at(1);
  }
  sort(food.begin(),food.end());

  /*test
  rep(i,N){
      cout<<food[i][0]<<" "<<food[i][1]<<endl;
  }
  cout<<endl;*/

  int dp1[N][T];
  rep(i,T){
      if(food.at(0).at(0)>i){dp1[0][i]=0;}
      else{dp1[0][i]=food.at(0).at(1);}
  }
  for(int i=1;i<N;i++){
      for(int j=0;j<T;j++){
          if(food.at(i).at(0)>j){dp1[i][j]=dp1[i-1][j];}
          else{dp1[i][j]=max(dp1[i-1][j],dp1[i-1][j-food.at(i).at(0)]+food.at(i).at(1));}
      }
  }

  /*test
  rep(i,N){
      rep(j,T){
          cout<<dp1[i][j]<<" ";
      }
      cout<<endl;
  }*/

  int ans=food.at(0).at(1);
  int m;

  for(int i=1;i<N;i++){
      m=dp1[i-1][T-1]+food.at(i).at(1);
      ans=max(ans,m);
      //cout<<m<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 35584
#include <iostream> 
#include <list>

using namespace std;

int main()
{
    int N, Q;
    cin >> N >> Q;
    
    list<int> list[N];
    
    for(int i = 0; i < Q; ++i)
    {
        int Command; cin >> Command;
        int t; cin >> t;
        
        if(Command == 0)
        {
            int val; cin >> val;
            list[t].insert(list[t].end(), val);
        }
        else if(Command == 1)
        {
            for(auto ite = list[t].begin(); ite != list[t].end(); ++ite)
              cout << (ite == list[t].begin() ? "" : " ") << *ite;
            cout << endl;
        }
        else if(Command == 2)
        {
            int s; cin >> s;
            
            list[s].splice(list[s].end(), move(list[t]));
            list[t].clear();
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 18732
#include "bits/stdc++.h"
using namespace std;
typedef long long ll; 
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll mod_pow(ll a, ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) {
		ll tmp = mod_pow(a, n / 2);
		return (tmp * tmp) % MOD;
	}
	return (a * mod_pow(a, n - 1)) % MOD;
}

vector<ll> fact;
vector<ll> inv_fact;

void comb_init(int n) {
	fact.resize(n + 1);
	inv_fact.resize(n + 1);
	fact[0] = inv_fact[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		inv_fact[i] = (inv_fact[i - 1] * mod_pow(i, MOD - 2)) % MOD;
	}
}

ll comb(int n, int k) {
	if (n < k) return 0;
	ll ret = fact[n];
	(ret *= inv_fact[k]) %= MOD;
	(ret *= inv_fact[n - k]) %= MOD;
	return ret;
}

int A[25001];
ll dp[25001][401][2];
ll dp2[401][2];
int cnt[401];

int main() {
	int N, K, M;
	cin >> N >> K >> M;
	comb_init(25000);
	for (int i = 0; i < M; i++) cin >> A[i];
	ll tot = (N - M + 1)*mod_pow(K, N - M) % MOD;
	for (int i = 0; i + K <= M; i++) {
		memset(cnt, 0, sizeof(cnt));
		bool ok = 1;
		for (int j = 0; j < K; j++) {
			cnt[A[i + j]]++;
			if (cnt[A[i + j]] > 1) {
				ok = 0;
				break;
			}
		}
		if (ok) {
			cout << tot << endl;
			return 0;
		}
	}
	memset(cnt, 0, sizeof(cnt));
	int F = 0;
	for (int i = 0; i < M; i++) {
		cnt[A[i]]++;
		if (cnt[A[i]] > 1) break;
		F++;
	}
	memset(cnt, 0, sizeof(cnt));
	int B = 0;
	for (int i = M - 1; i >= 0; i--) {
		cnt[A[i]]++;
		if (cnt[A[i]] > 1) break;
		B++;
	}
	dp[1][1][0] = K;
	dp[1][1][M == 1] = K;
	for (int i = 2; i <= N; i++) {
		memset(dp2, 0, sizeof(dp2));
		for (int j = 1; j < K; j++) {
			(dp[i][j + 1][0] += (K - j)*dp[i - 1][j][0]) %= MOD;
			(dp[i][j + 1][1] += (K - j)*dp[i - 1][j][1]) %= MOD;
			(dp2[1][0] += dp[i - 1][j][0]) %= MOD;
			(dp2[j + 1][0] += MOD - dp[i - 1][j][0]) %= MOD;
			(dp2[1][1] += dp[i - 1][j][1]) %= MOD;
			(dp2[j + 1][1] += MOD - dp[i - 1][j][1]) %= MOD;
		}
		for (int j = 1; j < K; j++) {
			(dp2[j][0] += dp2[j - 1][0]) %= MOD;
			(dp[i][j][0] += dp2[j][0]) %= MOD;
			(dp2[j][1] += dp2[j - 1][1]) %= MOD;
			(dp[i][j][1] += dp2[j][1]) %= MOD;
			if (j >= M) (dp[i][j][1] += dp[i][j][0]) %= MOD;
		}
	}
	if (F == M) {
		ll sum = 0;
		for (int i = 1; i < K; i++) (sum += dp[N][i][1]) %= MOD;
		(sum *= inv_fact[K]) %= MOD;
		(sum *= fact[K - M]) %= MOD;
		ll ans = tot;
		(ans += MOD - sum) %= MOD;
		cout << ans << endl;
	}
	else {
		ll sum = 0;
		for (int i = 0; i <= N - M; i++) {
			ll L = 0;
			for (int j = F; j < K; j++) (L += dp[i + F][j][0]) %= MOD;
			(L *= inv_fact[K]) %= MOD;
			(L *= fact[K - F]) %= MOD;
			ll R = 0;
			for (int j = B; j < K; j++) (R += dp[N - (i + M) + B][j][0]) %= MOD;
			(R *= inv_fact[K]) %= MOD;
			(R *= fact[K - B]) %= MOD;
			(sum += L * R%MOD) %= MOD;
		}
		ll ans = tot;
		(ans += MOD - sum) %= MOD;
		cout << ans << endl;
	}
 }

Measured memory_bytes: 157440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

string s;
int main() {
	cin>>s;
	string t="";
	ll ans=0;
	while(s.size()!=0){
		string now="";
		for(int i=s.size()-1;i>=0;i--){
			now.push_back(s[i]);
			reverse(now.begin(),now.end());
			s.pop_back();
			if(now!=t){
				t=now;
				ans++;
				break;
			}
		}
	}
	cout << ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    ll n;
    cin >> n;
    
    ll ans = 0;
    for (ll i = 1; i <= n; ++i) {
        ans += i * (n + 1 - i);
    }
    rep(i, n-1) {
        ll u, v;
        cin >> u >> v;
        if (u > v) swap(u, v);
        ans -= u * (n + 1 - v);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int manhattan(int A, int B, int C, int D)
{
  return abs(A - C) + abs(B - D);
}

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> a(N), b(N), c(M), d(M);
  for (int i = 0; i < N; i++) cin >> a.at(i) >> b.at(i);
  for (int i = 0; i < M; i++) cin >> c.at(i) >> d.at(i);
  
  for (int i = 0; i < N; i++)
  {
    int ans, min = inf;
    for (int j = 0; j < M; j++)
    {
      int dist = manhattan(a.at(i), b.at(i), c.at(j), d.at(j));
      if (chmin(min, dist)) ans = j + 1;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,x,y;
    int flag=0;
    int e1max=-101,e2min=9999,num;
    cin>>n>>m>>x>>y;
    for(int i=0;i<n;i++)
    {
        cin>>num;
        if(num>e1max)
            e1max=num;
    }
    for(int i=0;i<m;i++)
    {
        cin>>num;
        if(num<e2min)
            e2min=num;
    }
        if(e2min>e1max&&e2min>x&&e1max<y)
            printf("No War\n");
        else
            printf("War\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s ;
    cin >> s;
    SORT(s);
    cout << (s == "abc" ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
i_max = n
i_min = 0
for x in range(m):
    l, r = map(int, input().split())
    i_max = min(r, i_max)
    i_min = max(l, i_min)

print(max(0,i_max - i_min + 1))

Measured memory_bytes: 3060
lis = [input() for _ in range(3)]
len = [len(lis[i]) for i in range(3)]
idx = [0,0,0]
name = ['A','B','C']

turn = 0
while 1:
  if len[turn] <= idx[turn]:
    print(name[turn])
    exit()
  else:
    tmp = ord(lis[turn][idx[turn]])-ord('a')
    idx[turn] += 1
    turn = tmp


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

int main() {
  int D, G;
  cin >> D >> G;
  G /= 100;

  vector<int> p(D), c(D);
  vector<int> CompletePoint(D);
  int NumLeast=0;
  for (int i = 0; i < D; i++) {
    cin >> p.at(i) >> c.at(i);
    CompletePoint.at(i) = (p.at(i)*(i+1)+c.at(i)/100);
    NumLeast += p.at(i);
  }
  
  for(int i = 0; i < (1 << (D)); i++){
    bitset<10> tmp(i);
    int Point=0;
    int Num=0;
    int id=0;
    for(int j = 0; j < (D); j++) {
      if(tmp.test(j)) {
        Point += CompletePoint.at(j);
        Num += p.at(j);
      } else {
        id = j;
      }
    }

    if (G - Point <= 0) {
      if (NumLeast > Num) {
        NumLeast = Num;
      }
    } else if (G - Point <= (id+1)*(p.at(id)-1)) {
      if ((G - Point)%(id+1)==0) {
        Num+=(G - Point)/(id+1);
      } else {
        Num+=((G - Point)/(id+1)+1);
      }
      if (NumLeast > Num) {
        NumLeast = Num;
      }
    }
  }
  cout << NumLeast;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin>>x;
    if(x>=30)
    {
    	cout<<"Yes\n";
    }
    else
    {
    	cout<<"No\n";
    }
	return 0;
}

Measured memory_bytes: 3644
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}
	ans := -1
	for i := 0; i <= n-k; i++ {
		max := x[i+k-1]
		min := x[i]
		var tmp int
		switch {
		case max > 0 && min > 0:
			tmp = max
		case max > 0 && min < 0:
			if max > -min {
				tmp = max - 2*min
			} else {
				tmp = max*2 - min
			}
		case max < 0 && min < 0:
			tmp = -min
		}
		if ans == -1 {
			ans = tmp
		} else {
			if tmp < ans {
				ans = tmp
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<string.h>
int p[1000]={0};
int x[1000]={0};
int t[1000]={0};
int main()
{
  int n,i,j,m,ll,sum=0,tt;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&t[i]);
  scanf("%d",&m);
  for(i=0;i<m;i++)scanf("%d %d",&p[i],&x[i]);
  for(i=0;i<m;i++)
  {
    sum = 0;
    tt = t[(p[i]-1)];
    t[(p[i]-1)] = x[i];
    for(j=0;j<n;j++)sum+=t[j];
    t[(p[i]-1)] = tt;
    printf("%d\n",sum);
   }









 return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
double a[200];
int main()
{
    int n;
    scanf("%d",&n);
    double sum = 0;
    for(int i = 0;i < n;i ++)
    {
        scanf("%lf",&a[i]);
        sum += a[i];
    }
    sum = sum / (double)n;
    //printf("%lf",sum);
    int index = 0;
    double eps = 100000;
    for(int i = 0;i < n;i ++)
    {
        if(abs(a[i] - sum) < eps)
        {
            index = i;
            eps = abs(a[i] - sum);
        }
    }
    printf("%d",index);
    return 0;
}


Measured memory_bytes: 256
private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main(args: Array<String>) {
    val r = readInt().toDouble()
    println("%.4f".format(java.lang.Math.PI * r * 2.0))
}


Measured memory_bytes: 35728
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const ll INF=1e15;
const int oo=0x3f3f3f3f;
const double eps=1e-10;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n;
const int Maxn=405;
ll sum[Maxn];
ll dp[Maxn][Maxn];
ll go(int L,int R){
	if(dp[L][R]!=INF)return dp[L][R];
	if(L==R)return dp[L][R]=0;
	if(L==R-1)return dp[L][R]=sum[R]-sum[L-1];
	for(int k=L;k<R;k++){
		chkmin(dp[L][R],go(L,k)+go(k+1,R)+sum[R]-sum[L-1]);
	}
	return dp[L][R];
}
int main(){
	n=in();
	for(int i=1;i<=n;i++){
		sum[i]=in();
		sum[i]+=sum[i-1];
	}
	for(int i=1;i<=n;i++)for(int j=i;j<=n;j++)dp[i][j]=INF;
	ll ans=go(1,n);
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;

const int maxn = 2e5 + 5;
const int maxs = 1e6 + 5;
const int INF = 998244353;

inline int qpow(int x, int y){
	int ret = 1;
	for(; y; y >>= 1){
		if(y & 1)
			ret = 1ll * ret * x % INF;
		x = 1ll * x * x % INF;
	}
	return ret;
}

int n, ans;
int a[maxn], inv[maxs], coe[maxs], sum[maxs];

int main(){
//	freopen("AGC038C.in", "r", stdin);
	FOR(i, 1, maxs){
		inv[i] = qpow(i, INF - 2);
		coe[i] = (inv[i] - coe[i] + INF) % INF;
		for(int j = i << 1; j <= maxs; j += i)
			(coe[j] += coe[i]) %= INF;
	}

	scanf("%d", &n);
	FOR(i, 0, n){
		scanf("%d", a + i);
		int res = 0;
		for(int j = 1; j * j <= a[i]; ++j) if(a[i] % j == 0){
			(res += 1ll * sum[j] * coe[j] % INF) %= INF;
			if(j * j != a[i])
				(res += 1ll * sum[a[i] / j] * coe[a[i] / j] % INF) %= INF;
			(sum[j] += a[i]) %= INF;
			if(j * j != a[i]){
				(sum[a[i] / j] += a[i]) %= INF;
			}
		}
		res = 1ll * res * a[i] % INF;
		(ans += res) %= INF;
	}
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 16224
import java.math.*
import java.util.ArrayDeque

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val edges = mutableListOf<Pair<Int, Int>>()
    val adjacency = Array(N) { mutableListOf<Int>() }

    val nodeNum = IntArray(N)

    for (i in 1 until N) {
        val (x, y) = readInputLine().split(" ").map { it.toInt() - 1 }
        edges.add(Pair(x, y))
        adjacency[x].add(y)
        adjacency[y].add(x)
    }
    
    val cs = readInputLine().split(" ").map { it.toInt() }.sortedDescending()

    val queue = ArrayDeque<Int>()
    queue.add(0)
    
    for (c in cs) {
        val node = queue.poll()!!
        nodeNum[node] = c
        
        for (e in adjacency[node]) {
            if (nodeNum[e] == 0) {
                queue.add(e)
            }
        }
    }

    var ans = 0
    
    for (e in edges) {
        ans += Math.min(nodeNum[e.first], nodeNum[e.second])
    }
    
    println(ans)
    println(nodeNum.joinToString(" "))
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 51752
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int a[n+10], b[m+10];
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  bool ans = true;
  int z = y - x;
  if (!(z>= 1)){
    cout << "No War" << endl;
    return 0;
  }
  for (int num = x + 1; num <= y;num++){
    rep(i, n)
    {
      if (!(a[i] < num))
      {
        ans = false;
        break;
      }
    }

    rep(i, m)
    {
      if (!(b[i] >= num))
      {
        ans = false;
        break;
      }
    }
    if(ans){
      cout << "No War" << endl;
      return 0;
    }
    else ans=true;
  }

  cout<<"War"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int H,W,ans=
  scanf("%d %d",&H,&W);
  int h,w;
  scanf("%d %d",&h,&w);
  ans=H*W-(h*W)-(H*w)+h*w;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
import math

n = int(input())
x_list = list(map(int,input().split()))
y_list = list(map(int,input().split()))

ans = []
Chebyshev = 0
for i in range(1,4):
  Minkowski = 0
  for x, y in zip(x_list, y_list):
    Minkowski += abs(x - y) ** (i)
    Chebyshev = max(Chebyshev, abs(x - y))
  ans.append(Minkowski ** (1/i))
ans.append(Chebyshev)
for out in ans:
  print(float(out))


Measured memory_bytes: 5700
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

int f(int num) {
	int cnt = 0;
	while (1) {
		if (num % 2 == 0) {
			cnt++;
			num /= 2;
		}
		else break;
	}
	return cnt;
}

signed main() {
	int N;
	cin >> N;
	int num;
	int ans = 0;
	rep(i, N) {
		cin >> num;
		ans += f(num);
	}
	cout << ans;
}

Measured memory_bytes: 256
List = []
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
k = int(input())

CW = []
for i in range(len(List)):
    for j in range(i+1,len(List)):
        if List[j]-List[i] <= k:
            CW.append(True)
        else:
            CW.append(False)

if all(CW):
    print("Yay!")
else:
    print(":(")

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
    int n,m;
    scanf ("%d %d\n",&n,&m);
    int *arr = (int *)calloc (n+1,sizeof (int));
    
    int ht[n+1];
    
    for (int i=1;i<n+1;i++)
    {
        scanf("%d ",ht+i);
    }
    
    for (int i=0 ; i<m ; i++)
    {
        int a1,a2;
        scanf ("%d %d\n",&a1,&a2);
        
        if (ht[a1] < ht[a2])
        {
            arr[a1] = -1;
            if (arr[a2] == -1);
            else arr[a2] = 1;
        }
        else if (ht[a1] > ht[a2])
        {
            arr[a2] = -1;
            if (arr[a1] == -1);
            else arr[a1] = 1;
        }
        else
        {
            arr[a1] = -1;
            arr[a2] = -1;
        }
        
    }
    
    int cnt = 0;
    for (int i=1;i<n+1;i++)
    {
        if (arr[i] != -1) cnt++;
    }
    printf("%d\n",cnt);
} 

Measured memory_bytes: 2512
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll a,v,b,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;

    if(abs(b-a)<=(v-w)*t){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }

}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

const int MAXN = 200005;

long long sum[MAXN];

int a[MAXN], x[MAXN];

int n;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		x[i] = (x[i - 1] ^ a[i]);
	for (int i = 1; i <= n; i++)
		sum[i] = sum[i - 1] + a[i];
	long long res = 0;
	for (int i = 1; i <= n; i++)
	{
		int l = i, r = n;
		while (l < r)
		{
			int k = (l + r + 1) >> 1;
			if ((x[k] ^ x[i - 1]) == (sum[k] - sum[i - 1]))
				l = k;
			else
				r = k - 1;
		}
		res += l - i + 1;
	}
	cout << res << endl;
	return 0;	
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}

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

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


int main() {
    int n, m; cin >> n >> m;
    vector<int> p(m);
    vector<string> s(m);
    rep(i,m) cin >> p[i] >> s[i], p[i]--;
    vector<bool> ok(100010, false);
    vector<int> w(100010, -1);
    int ac = 0, wa = 0;
    rep(i,m) {
        if (ok[p[i]]) continue;
        if (s[i] == "AC") {
            ac++;
            ok[p[i]] = true;
            w[p[i]] = i;
        }
    }
    rep(i,m) {
        if (s[i] == "WA" && i < w[p[i]] && ok[p[i]]) {
            wa++;
        }
    }
    printf("%d %d\n", ac, wa);
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
    	int n,len,a;
    	string s,s2,s3;
    	cin >> n >> s >> s2;
    	len=s.size()+s2.size();
    	
    	for(int i=0;i<s2.size();i++){
    		for(int j=0;j<s.size();j++){
    			bool ok=true;
    			if(s2[i]==s[j]){
    				for(int k=i,t=j;t<s.size();k++,t++){
    					if(s2[k]!=s[t]){
    						ok=false;
    					}
    				}
    				a=s.size()-(s.size()-j)+s2.size();
    				if(ok&&n<=a) len=min(a,len);
    			}
    		}
    	}
    	
    	cout << len << endl;
    	return 0;
    }

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long L, R;
    cin >> L >> R;
    int a = L % 2019;
    int b = R % 2019;
    if(L / 2019 != R / 2019){
        cout << 0 << endl;
        return 0;
    }
    long long ans = 2019;
    for(int i = a; i <= b; i++){
        for(int j = i + 1; j <= b; j++){
            if(i * j % 2019 < ans) ans = i * j % 2019;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
using namespace std;
#define pr(x) cout<<x
#define prs cout<<" "
#define prn cout<<"\n"
#define sc(x) cin>>x
#define ll long long int
int arr[1000005][3];
int dp[1000005][3];
int n;

int main()
{
    ios :: sync_with_stdio(false); cin.tie(0);
    int t=1;
   // cin >> t;
    for(int i9 = 1; i9 <= t; i9++)
    {
        cin>>n;
        int res=0;
        //cout<<"Cae #"<<i9<<": "<<res<<endl;
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<3; j++)
             cin>>arr[i][j];
        }
        memset(dp, 0, sizeof(dp));
        dp[0][0]=arr[0][0];
        dp[0][1]=arr[0][1];
        dp[0][2]=arr[0][2];
        for(int i=1; i<n; i++)
        {
               dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
               dp[i][1]=arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
               dp[i][2]=arr[i][2]+max(dp[i-1][0],dp[i-1][1]);
        }
        res = INT_MIN;
        for(int i=0; i<3; i++)
           res = max(res, dp[n-1][i]);
        cout<<res<<endl;
    }
    
}

Measured memory_bytes: 14592
n = int(input())
h = [int(_) for _ in input().split()]
mc = [0, abs(h[0]-h[1])] #足場1, 2に辿り着くまでに支払うコストの最小値
for i in range(2,n):
    mc.append(min(mc[i-2]+abs(h[i-2]-h[i]), mc[i-1]+abs(h[i-1]-h[i])))
print(mc[n-1])


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string revers = "";
            for(int i = input.Length - 1; i >= 0; i--)
            {
                revers += input[i];
            }
            
            if(revers == input)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)2e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)2e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (2 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 2, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 1) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 2;
    LL sum = a;
    while(b){
        if(b&2)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

double exp(double a, LL b){
    double res = 1;
    double sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

PII operator+(const PII &a, const PII &b){
    return PII(a.first + b.first, a.second + b.second);
}

vector<vector<int> > xc(100001), yc(100001);

PII func(PII p){
    PII res(0, 0);
    if(!xc[p.first].empty()){
        vector<int> line = xc[p.first];
        xc[p.first].clear();
        ++res.first;
        for(auto &i:line){
            res = res + func(PII(p.first, i));
        }
    }
    if(!yc[p.second].empty()){
        vector<int> line = yc[p.second];
        yc[p.second].clear();
        ++res.second;
        for(auto &i:line){
            res = res + func(PII(i, p.second));
        }
    }
    return res;
}

signed  main(){
    string s, d;
    cin >> d >> s >> d;
    cout << "A" << s[0] << "C" << endl;
    return 0;
}



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

int main(void)
{
    char s[100005],revs[1000005];
    scanf("%s", s);
    int n=0,i;
    while(strncmp(&s[n], "\0", 1)!=0) n++;

    for(i=0; i<n; i++) revs[i]=s[n-i-1];
    i=0;
    while(i!=n)
    {
        if(strncmp(revs+i, "maerd",5)==0) i+=5;
        else if(strncmp(revs+i, "remaerd",7)==0) i+=7;
        else if(strncmp(revs+i, "esare",5)==0) i+=5;
        else if(strncmp(revs+i, "resare",6)==0) i+=6;
        else
        {
            printf("NO");
            break;
        }
    }
    if(i==n) printf("YES");
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll r, d, x; cin >> r >> d >> x;
    for(int i = 1; i <= 10; i++)
    {
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int r, d, x;

    cin >> r >> d >> x;
    int ans = x;
    for (int i = 0; i < 10; i++)
    {

        cout << r * ans - d << endl;
        ans = r * ans - d;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>

using namespace std;

int main(){
	long long n, k, ans = 0;
	cin >> n >> k;
	vector<tuple<long long, long long>> a(n);
	vector<vector<int>> b(n + 1, vector<int>(n + 1));
	vector<long long> x(n), y(n);
	for(int i = 0; i < n; i++){
		cin >> get<0>(a[i]) >> get<1>(a[i]);
		x[i] = get<0>(a[i]); y[i] = get<1>(a[i]);
	}
	sort(begin(x), end(x));
	sort(begin(y), end(y));
	ans = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
	map<int, int> xid, yid;
	for(int i = 0; i < n; i++){
		xid[x[i]] = i + 1;
		yid[y[i]] = i + 1;
	}
	for(int i = 0; i < n; i++){
		b[xid[get<0>(a[i])]][yid[get<1>(a[i])]]++;
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			b[i][j] += b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];
		}
	}
	for(int xl = 1; xl <= n; xl++){
		for(int xr = xl + 1; xr <= n; xr++){
			for(int yl = 1; yl <= n; yl++){
				for(int yr = yl + 1; yr <= n; yr++){
					int t;
					t = b[xr][yr] - b[xl - 1][yr] - b[xr][yl - 1] + b[xl - 1][yl - 1];
					if(t >= k){
						ans = min(ans, (x[xr - 1] - x[xl - 1]) * (y[yr - 1] - y[yl - 1]));
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2
 
using namespace std;

int main() {
	int a, b;
	scanf( "%d%d", &a, &b );
	printf( "%d", max( 0, a - 2 * b ) );
	return 0;
}

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

using namespace std;

typedef long long LL;

char s[105];

int k;

int main(){
    cin>>s+1;
    cin>>k;

    int n=strlen(s+1);

    char ch=s[1];
    int cur=1;

    vector<pair<char,int>> v;
    for(int i=2;i<=n;++i){
        if(s[i]==ch){
            ++cur;
        }else{
            v.push_back(make_pair(ch,cur));
            ch=s[i];
            cur=1;
        }
    }

    if(cur){
        v.push_back(make_pair(ch,cur));
    }


    LL res;
    if((int)v.size()==1){
        cout<<1ll*n*k/2;
    }else{
        if(v[0].first!=v.back().first){
            int t=0;
            for(auto& it:v){
                t+=it.second/2;
            }
            res=1ll*t*k;
        }else{
            int x=(v[0].second+v.back().second)/2;
            int t=0;
            for(int i=1;i<(int)v.size()-1;++i){
                t+=v[i].second/2;
            }

            res=1ll*x*(k-1)+1ll*t*k;
            res+=v[0].second/2+v.back().second/2;
        }

        cout<<res;
    }

    return 0;
}


Measured memory_bytes: 3632