akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> wordList = new ArrayList<>();

		while (sc.hasNextLine()) {
			wordList.add(sc.nextLine());
		}

		boolean isCorrect = true;
		Set<String> checkHash = new HashSet<>();
		int listSize = wordList.size();
		for (int i = 1 ; i < listSize; i++) {
			String word = wordList.get(i);
			if (i == 0) {
				continue;
			}
			if (i == 1) {
				checkHash.add(word);
				continue;
			}
			if (checkHash.contains(word)) {
				isCorrect = false;
				break;
			}
			String preWord = wordList.get(i-1);
			if (word.charAt(0) != (preWord.charAt(preWord.length()-1))) {
				isCorrect = false;
				break;
			}
			checkHash.add(word);
		}
		if (isCorrect) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b; 
}

int main(){

    int x;
    cin >> x;

    ll l = lcm(360, x);

    cout << l / x << endl;

    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<utility>
#include<math.h>

using namespace std;

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

	vector<double>v(N);

	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}

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

	double gousei;

	for (int i = 0; i < N - 1; i++) {
		gousei = (v[i] + v[i + 1]) / 2;
		v[i + 1] = gousei;
	}

	cout << setprecision(10) << v[N - 1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define MAX 10000

int isprime(int n);

int main(void){
	int n,i = 0,c = 0,A[MAX];
	double x;
	for(i = 0; i < MAX; i++){
		A[i] = 0;
	}
	scanf("%d" ,&n);
	for(i = 0; i < n; i++){
		scanf("%d",&A[i]);
		if(isprime(A[i]) == 1){
			c++;
		}
	}
	printf("%d\n" ,c);
	return 0;
}

int isprime(int n){
	int i = 0;
	if(n == 2){
		return 1;
	}
	if(n < 2 || n % 2 == 0){
		return 0;
	}
	i = 3;
	while(i <= sqrt(n)){
		if(n % i == 0){
			return 0;
		}
		i = i + 2;
	}
	return 1;
}


Measured memory_bytes: 2092
module Main where

import Data.Functor

main :: IO ()
main =  do
 { [n] <- getInts
 ; putStrLn $ (' ':) $ unwords $ map show $ takeWhile (n >=) $ [ x | x <- [3 ..], mod x 3 == 0 || elem '3' (show x) ]
 }

getInts :: IO [Int]
getInts = map read . words <$> getLine

Measured memory_bytes: 4036
#include <iostream>
 
using namespace std;
 
int main(){
    int A;
    A >= 3 && A <= 20;
   cin >> A;
    int B;
    B >= 3 && B <= 20;
   cin >> B;
  if(A == B){
    cout << A+B << endl;}
    else if(A > B){
    cout << A+(A-1) << endl;}
    else if(A < B) {
        cout << B+(B-1) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m; cin >> n >> m;

    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = input().split()
for i in range(N):
  a[i] = int(a[i])
index = 1
count = 0
for i in range(N):
  if a[i] == index:
  	index += 1
  else:
    count += 1
if count == N:
  count = -1
print(count)


Measured memory_bytes: 18960
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N,C = LI()
p = [[(0,0)] for _ in range(C+1)]
for _ in range(N):
    s,t,c = LI()
    p[c].append((s,t))

im = [0 for _ in range(10**5+1)]
for x in p:
    x.sort()
    for i in range(1,len(x)):
        s,t = x[i]
        if x[i-1][1] < s: s -= 1
        im[s] += 1
        im[t] -= 1

ans = 0
tm = 0
for t in im:
    tm += t
    ans = max(ans,tm)
print(ans)

Measured memory_bytes: 56536
// AOJ 0590: Available Areas
// 2017.10.1 bal4u@uu
// 2017.11.14

#include <stdio.h>

int check(int s)
{
	int x, t;

	for (x = 1; ; x++) {
		t = x << 1;
		if (t * (x+1) > s) break;
		if ((s - x) % (t + 1) == 0) return 0;
	}
	return 1;
}

char buf[15], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, s, ans;

	fgets(p=buf, 15, stdin), n = getint();
	ans = 0; 
	while (n -- > 0) {
		fgets(p=buf, 15, stdin);
		s = getint();
		if (check(s)) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long  ll;
const int N = 1e5 + 4;

int h[N] , n , memo[N];

int solve(int indx){
    if(indx == n - 1)
        return 0;

    int &ret = memo[indx];
    if(~ret)
        return ret;

    ret = inf;
    ret = min(ret , solve(indx + 1) + abs(h[indx] - h[indx + 1]));
    if(indx + 2 <= n - 1)ret = min(ret , solve(indx + 2) + abs(h[indx] - h[indx + 2]));
    return ret;
}

int main() {
    ios::sync_with_stdio() , cin.tie(0) , cout.tie();
    cin >> n;
    for(int i = 0 ; i < n ; ++i)
        cin >> h[i];

    memset(memo , -1 , sizeof memo);
    cout << solve(0) << '\n';
}


Measured memory_bytes: 4096
#include "bits/stdc++.h"
using namespace std;
int a[100001][2];
int main()
{
	memset(a, 0, sizeof(a));
	int n, indeven, even = 0, alteven = 0, indodd, odd = 0, altodd = 0;
	scanf("%d", &n);
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		++a[j][i % 2];
	}
	for(int i = 1; i <= 100000; ++i)
	{
		if(even < a[i][0])
		{
			alteven = even;
			even = a[i][0];
			indeven = i;
		}
		else if(alteven < a[i][0])
		{
			alteven = a[i][0];
		}
		if(odd < a[i][1])
		{
			altodd = odd;
			odd = a[i][1];
			indodd = i;
		}
		else if(altodd < a[i][1])
		{
			altodd = a[i][1];
		}
	}
	if(indeven == indodd)
	{
		printf("%d\n", n - max(even + altodd, alteven + odd));
	}
	else
	{
		printf("%d\n", n - even - odd);
	}
}

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <set>
#include <utility>
using namespace std;

vector<pair<int,int> > al[609][609];
vector<pair<int,int> > bl[609][609];
vector<pair<int,int> > da;
vector<pair<int,int> > db;
int A[609][609];
int B[609][609];
vector<pair<int,int> > V[2][2];

void dfsa(int x, int y, int v){
    A[x][y] = v;
    for (auto i = al[x][y].begin(); i != al[x][y].end(); i++){
        if (A[i->first][i->second]==0) dfsa(i->first,i->second,3-v);
    }
}

void dfsb(int x, int y, int v){
    B[x][y] = v;
    for (auto i = bl[x][y].begin(); i != bl[x][y].end(); i++){
        if (B[i->first][i->second]==0) dfsb(i->first,i->second,3-v);
    }
}

int main(){
    int N;
    scanf("%d", &N);
    int D1, D2;
    scanf("%d %d", &D1, &D2);
    {
        int j = 0;
        while (j*j<D1) j++;
        for (int i = 0; i*i<D1; i++){
            while (i*i+j*j>D1) j--;
            if (i*i+j*j==D1){
                da.push_back(make_pair(i,j));
                da.push_back(make_pair(-i,-j));
                da.push_back(make_pair(j,-i));
                da.push_back(make_pair(-j,i));
            }
        }
        j = 0;
        while (j*j<D2) j++;
        for (int i = 0; i*i<D2; i++){
            while (i*i+j*j>D2) j--;
            if (i*i+j*j==D2){
                db.push_back(make_pair(i,j));
                db.push_back(make_pair(-i,-j));
                db.push_back(make_pair(j,-i));
                db.push_back(make_pair(-j,i));
            }
        }
    }
    for (int i = 0; i < 2*N; i++){
        for (int j = 0; j < 2*N; j++){
            for (int k = 0; k < da.size(); k++){
                int x = i+da[k].first, y = j+da[k].second;
                if (x>=0&&x<2*N&&y>=0&&y<2*N){
                    al[i][j].push_back(make_pair(x,y));
                }
            }
            for (int k = 0; k < db.size(); k++){
                int x = i+db[k].first, y = j+db[k].second;
                if (x>=0&&x<2*N&&y>=0&&y<2*N){
                    bl[i][j].push_back(make_pair(x,y));
                }
            }
        }
    }
    for (int i = 0; i < 2*N; i++){
        for (int j = 0; j < 2*N; j++){
            if (A[i][j]==0) dfsa(i,j,1);
            if (B[i][j]==0) dfsb(i,j,1);
            V[A[i][j]-1][B[i][j]-1].push_back(make_pair(i,j));
        }
    }
    for (int i = 0; i < 2; i++){
        for (int j = 0; j < 2; j++){
            if (V[i][j].size()>=N*N){
                for (int k = 0; k < N*N; k++){
                    printf("%d %d\n", V[i][j][k].first, V[i][j][k].second);
                }
                return 0;
            }
        }
    }
}


Measured memory_bytes: 174588
import sys
F = sys.stdin
Continue = True
while Continue:
    N = int(F.readline().strip("\n"))
    if N == 0:
        Continue = False
        break
    else:
        Score = [None] * N
        for i in range(N):
            Score[i] = int(F.readline().strip("\n"))
        Score.sort()
        print(sum(Score[1:N-1])//(N-2)) 



Measured memory_bytes: 5608
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  ll k;
  cin >> k;
  FOR(n, 2, 51){
    ll rem = k % n;
    ll base = (k - rem) / n;
    vector<ll> vec = vector<ll>(n, 0);
    rep(i, n){
      vec[i] = i + base;
    }
    rep(i, rem){
      vec[i] += n;
      rep(j, n){
        if(i != j)vec[j]--;
      }
    }
    bool flag = true;
    rep(i, n){
      if(vec[i] > (ll)1e16 + 1000){
        flag = false;
        break;
      }
    }
    if(flag){
      cout << n << endl;
      rep(i, n){
        cout << vec[i];
        if(i == n - 1)cout << endl;
        else cout << " ";
      }
      return 0;
    }
  }
	return 0;
}


Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out
//入出力：http://kaitei.net/cpp/iostream/
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

long A,B;
long ans;

long gcd(long a,long b){
	long x=a*b;
	long tmp;
	if(a<b){
		tmp = a;
		a = b;
		b = tmp;
	}
	long r = a % b;
	while(r!=0){
		a = b;
		b = r;
		r = a % b;
	}
	return x/b;
}

void solve(){
	ans = gcd(A,B);
}

int main(){
	cin >> A >> B;

	solve();

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 220
// 44

using namespace std;

const int MOD = (int) 1e9 + 7;
const int MAXN = 3000;

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

int dp[2][MAXN + 1][2];

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, j, n, m;
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(i = 0; i <= n; i++) {
        dp[0][i][(i == 0)] = 1;
    }
    for(int cur = 1; cur <= m; cur++) {
        memset(dp[cur & 1], 0, sizeof(dp[cur & 1]));
        for(i = 0; i <= n; i++) {
            for(int k = 0; k < 2; k++) {
                if(i > 0) {
                    dp[cur & 1][i][k | (i == 1)] += dp[1 - cur & 1][i][k];
                    mod(dp[cur & 1][i][k | (i == 1)]);
                    dp[cur & 1][i - 1][k | (i == 1)] += dp[1 - cur & 1][i][k];
                    mod(dp[cur & 1][i - 1][k | (i == 1)]);
                }
                if(i < n) {
                    dp[cur & 1][i][k] += dp[1 - cur & 1][i][k];
                    mod(dp[cur & 1][i][k]);
                    dp[cur & 1][i + 1][k] += dp[1 - cur & 1][i][k];
                    mod(dp[cur & 1][i + 1][k]);
                }
            }
        }
    }
    int ans = 0;
    for(i = 0; i <= n; i++) {
        ans += dp[m & 1][i][1];
        mod(ans);
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    string s;
    cin>>s;
    vi r,l;
    vi vec(100001,0);
    for(int i=0; i<s.size(); ++i)
    {
    	if(s[i]=='R' && s[i+1]=='L')
    	{
    		r.pb(i+1);
    		l.pb(i+2);
    	}
    	
    }
    for(int i=0; i<s.size(); ++i)
    {
    	int s1=0,e1=r.size()-1,s2=0,e2=l.size()-1;
    	if(s[i]=='R')
    	{
    		int key = i+1;
    		while(s1<e1)
    		{
    			int m = (s1+e1)/2;
    			if(key>r[m])
    				s1 = m+1;
    			else
    				e1 = m;
    		}
    		int x = r[s1]-key;

    		if(x%2)
    		{
    			++vec[r[s1]+1];
    		}
    		else
    			++vec[r[s1]];
    	}
    	else
    	{
    		int key = i+1;
    		while(s2<e2)
    		{
    			int m = (s2+e2)/2;
    			if(key>r[m])
    				s2 = m+1;
    			else
    				e2 = m;
    		}
    		if(l[s2]>key)
    			--s2;
    		int x = key - l[s2];
    		if(x%2)
    			++vec[l[s2]-1];
    		else
    			++vec[l[s2]];
    	}
    }
    for(int i=1; i<=s.size(); ++i)
    {
    	cout<<vec[i]<<" ";
    }


}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    string s;
    cin >> s;

    int sum = 0;

    for (auto x: s)sum += (x - '0');
    if (sum % 9 == 0)cout << "Yes";
    else cout << "No";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

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

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

    int n, cont = 0, ans =0;
    cin >> n;

    int v[n];

    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    //        .
    // i: 6 5 6 8
    //    .
    // j: 6 5 6 8

    for(int i = n-1; i > 0; i--){
        for(int j = i-1; j >= 0; j--){
            if(v[i] >= v[j])
                cont++;
        }
        if(cont == i)
            ans++;
        cont = 0;
    }

    ans++;
    cout << ans << endl;


}


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

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template<typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	int N;
	cin >> N;
	vi D(N);
	cin >> D;
	int M;
	cin >> M;
	vi T(M);
	cin >> T;

	sortall(D);
	sortall(T);
	int d = 0, t = 0;
	
	while (true) {
		while (d < N && D[d] != T[t]) {
			d++;
		}

		if (d >= N) {
			cout << "NO" << endl;
			return 0;
		}
		else {
			d++;
			t++;
		}

		if (t == M) {
			cout << "YES" << endl;
			return 0;
		}
	}

	


	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline void chmin(T &a, T b){if(a>=b)a=b;}
template<class T> inline void chmax(T &a, T b){if(a<=b)a=b;}
typedef long long ll;
const int INF = 1e9;

int a[5];
// 待ち時間が少ないものから
int main(){
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    int rest = INF;
    int sum = 0;
    REP(i,5){
        if(a[i]%10!=0){
            chmin(rest,a[i]%10);
            sum += a[i] + (10-a[i]%10);
        } else {
            sum += a[i];
        }
    }
    if(rest==INF) cout << a[0] + a[1] + a[2] + a[3] + a[4] << endl;
    else  cout << sum - (10-rest) << endl;

    return 0;
}



Measured memory_bytes: 256
#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--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

map<char,int> mp;

int main(){
    int h, w;
    cin >> h >> w;
    rep(i, h * w) {
        char c;
        cin >> c;
        mp[c]++;
    }
    int p = 0, q = 0;
    for(auto e : mp){
        if (e.second % 4 != 0) p++;
        if (e.second % 2 != 0) q++;
    }

    int t = ((h%2)*w + (w%2)*h) / 2;

    if (q <= 1 && p <= t) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
int c[] = {10,50,100,500};
int k[4];
int a[4];
int main(void){
  bool f = false;
  while(cin >> n){
    if(!n) break;
    if(f) cout << endl;
    f = true;
    memset(a,0,sizeof(a));
    int sum = 0;
    for(int i = 0; i < 4; i++){
      cin >> k[i];
      sum += k[i]*c[i];
    }

    sum -= n;
    for(int i = 3; i >= 0; i--){
      a[i] += sum/c[i];
      sum %= c[i];
    }

    for(int i = 0; i < 4; i++){
      if(max(0,k[i] - a[i])){
	cout << c[i] << " " << max(0,k[i] - a[i]) << endl;
      }
    }
  }
}

Measured memory_bytes: 1160
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[]) {
	int a, b, t;
	cin >> a >> b >> t;
	int ans = t / a * b;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a, b;
    scanf("%d %d",&a,&b);
    // 出力
    if(a <= 5)
        cout << 0 << endl;
    else if(a >= 13)
        cout << b << endl;
    else
        cout << b / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using lint=long long;
using namespace std;

int main()
{
	int N,M;
	
	cin >> N >> M;
	vector<vector<int>> edge(N);
	vector<int> in(N,0);
	
	for(int i=0;i<N-1+M;i++)
	{
		int A,B;
		cin >> A >> B;
		A--;
		B--;
		edge[A].push_back(B);
		in[B]++;
	}
	
	queue<int> q;
	vector<int> dp(N,0);
	for(int i=0;i<N;i++)
		if(in[i]==0)
			q.push(i);
	while(!q.empty())
	{
		int cur=q.front();
		q.pop();
		
		for(auto&& i:edge[cur])
		{
			//tsort
			in[i]--;
			if(in[i]==0)
				q.push(i);
			//dp
			dp[i]=cur+1;
		}
	}
	
	for(auto&& i:dp)
		cout << i << endl;
	return 0;
}



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

int main()
{
    long long N, M;
    cin >> N >> M;

    long long ans = 0;
    if (N * 2 < M)
    {
        ans = N;
        M -= 2 * N;
        ans += M / 4;
    }
    else if (N * 2 > M)
    {
        ans = M / 2;
    }
    else
    {
        ans = N;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(i % 2 == 1 and s.at(i) =='R'){
      cout << "No";
      return 0;
    }
    else if(i % 2 == 0 and s.at(i) =='L'){
      cout << "No";
      return 0;
    }
  }
  cout <<"Yes";
  
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const ll INF=1LL<<60;
const ll MOD=1000000007;

vector<vector<P>> hen(2500, vector<P>(0));
vector<vector<ll>> rhen(2500, vector<ll>(0));
vector<bool> check(2500,0);

void dfs(ll x,vvl &rhen){
    if(check[x])return;
    check[x]=1;
    for(auto p: rhen[x])dfs(p,rhen);
    return;
}


int main(){
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    ll PP;
    cin >> PP;
    vector<ll> A(M,0);
    vector<ll> B(M,0);
    vector<ll> C(M,0);
    for(ll i=0;i<M;i++){
        cin>>A[i]>>B[i]>>C[i];
        A[i]--;B[i]--;C[i]-=PP
    ;}
    vector<vector<P>> hen(N, vector<P>(0));
    vector<vector<ll>> rhen(N, vector<ll>(0));
    for(ll i=0;i<M;i++){
        hen[A[i]].emplace_back(P(B[i],C[i]));
        rhen[B[i]].emplace_back(A[i]);
    ;}

    dfs(N-1,rhen);

    vector<ll> d(N,-INF);
    d[0]=0;
    //ベルマンフォード法
    for(ll i=0;i<N;i++){
        for(ll j=0;j<N;j++){
            if(d[j]==-INF)continue;
            for(auto p: hen[j]){
                if(d[p.first]<d[j]+p.second){
                d[p.first]=d[j]+p.second;
                if(i==N-1&&check[p.first]){cout<<-1<<endl;return 0;}
                }
            ;}
        ;}
    ;}
    ll ans=d[N-1];
    //行けない場合
    if(ans==-INF){
        cout<<-1<<endl;return 0;
    }

    cout<<max(ans,0LL)<<endl;
    

    return 0;
}


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

int main() {
  int N, l, r;
  int x = 0;
  cin >> N;
  
  for (int i = 0; i<N; i++) {
    cin >> l >> r;
    x += r - l + 1;
  }
  
  cout << x << endl;
  
}

Measured memory_bytes: 256
#define LOCAL
#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 rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 100001;
static const ll MOD = 1000000007;
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; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll n, d; cin >> n >> d;
	ll ans = 0;
	rep(i, n){
		ll x, y; cin >> x >> y;
		if(d * d >= x * x + y * y) ans ++;
	}

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


Measured memory_bytes: 3620
/*
  AtCoder Beginner Contest 078
  A - HEX

  方針
    文字列の大小を判定する。

  実装
    char型も普通の数値型と同様にそのまま大小判定ができる。
*/

#include<iostream>
using namespace std;

char X, Y;

int main() {
  scanf("%c %c", &X, &Y);

  if (X == Y) printf("=\n"); 
  else if (X < Y) printf("<\n");
  else if (X > Y) printf(">\n");

  return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);	
      	long a = long.Parse(input[1]);
      	long b = long.Parse(input[2]);
      	
      	long ans = 0;
      
      	long c = n/(a+b);
      
        long d = 0;
      	if(a <= n%(a+b)){
          d=a;
        }
      	else{
          d=n%(a+b);  
        }
      	
		Console.WriteLine(c*a+d);
	}
}

Measured memory_bytes: 11092
#include<stdio.h>

int main(void){
    int n,a,b;
    
    scanf("%d\n",&n);
    
    if(n==1){
        printf("Hello World\n");
    }else{
        scanf("%d\n %d",&a,&b);
        printf("%d\n",a+b);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	int M;
	cin >> M;
	cout << 48 - M << endl;
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long LL;
string s,t;
LL n,m;
int main()
{
	cin>>n>>m>>s>>t;
	LL d=__gcd(n,m);
	LL ans=n*m/d;
	for(int i=0,j=0;i<n;i+=n/d,j+=m/d)
	{
		if(s[i]!=t[j]){cout<<-1;return 0;}
	}
	cout<<ans;return 0;

}


Measured memory_bytes: 512
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
func=lambda x:x%3==0

aa=func(a+b+c-d-e-f)
bb=func(a+b+c-g-h-i)
cc=func(a+d+g-b-e-h)
dd=func(a+d+g-c-f-i)
if aa and bb and cc and dd:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

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; }

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



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

    int a, b;
    int now = 1, ans = 0;

    //入力
    cin >> a >> b;
    b++;
    while (now <= b) {
        int x = a / (now * 2) * now + max((int)0, a % (now * 2) - now);
        int y = b / (now * 2) * now + max((int)0, b % (now * 2) - now);
        //cout << now << ":" << x << " " << y << endl;
        if ((y - x) % 2 == 1) {
            ans += now;
        }
        now *= 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
nn=int((n*2)**0.5)
if n*2!=nn*(nn+1):
  print("No")
else:
  print("Yes")
  print(nn+1)
  Ans=[[0]*nn for _ in range(nn+1)]
  for i in range(nn):
    for j in range(nn-i):
      Ans[i][i+j]+=nn*i-i*(i-1)//2+j+1
      Ans[i+j+1][i]+=nn*i-i*(i-1)//2+j+1
  for a in Ans:
    print(nn,*a)

Measured memory_bytes: 12380
#include <iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<set>
typedef long long int ll;
using namespace std;

int main(){
    string str;
    cin >> str;
    str.insert(str.begin() + 4, ' ');
    cout << str <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main ()
{
	int L, R, d;
	int count = 0;
	scanf("%d", &L);
	scanf("%d", &R);
	scanf("%d", &d);
	for (int i = L; i <=R; i++)
	{
		if (i % d == 0)
			count++;
	}

	printf("%d\n", count);

	return (0);
}


Measured memory_bytes: 1736
N,K=map(int,input().split())

check=[0]*N

for _ in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for a in A:
        check[a-1]+=1

ans=0
for c in check:
    if c==0:
        ans+=1
print(ans)

Measured memory_bytes: 9192
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int n,d;
  cin >>n>>d;
  int ans = 0;
  
  vector<vector<int>> p(n,vector<int>(d));
  
  vector<int> hei(130);
  rep(i,130) {
  hei[i]=i*i;
  }
  
  
  rep(i,n) {
    rep(j,d) {
    cin >> p.at(i).at(j);
    }
  }
  
  rep(i,n-1) {
    for(int j = i+1;j<n;j++) {
      int sa=0;
      rep(k,d) {
      sa+=(p.at(i).at(k)-p.at(j).at(k))*(p.at(i).at(k)-p.at(j).at(k));
      }
        for(int x : hei) {
          if (x==sa) {
          ans++;
          break;
          } 
        }
    }
  }
   
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int N,count;
  char x;
  string S;
  count=0;
  cin>>N;
  cin>>S;

  for(int i=0;i<=S.length()-1;i++)
  {
    if(x==S[i])
     continue;
    else
    {
      count++;
      x=S[i];
    }
  }
  
cout<<count;
return 0;
}

Measured memory_bytes: 512
a,b,c = map(int, input().split())
d,e,f = map(int, input().split())
g,h,i = map(int, input().split())
bingo = [a,b,c,d,e,f,g,h,i]

n = int(input())

for i in range(n):
  num = int(input())
  if num in bingo:
    bingo = [str(bingo[i]) for i in range(len(bingo))]
    bingo[bingo.index(str(num))] = 0
    bingo = [int(bingo[i]) for i in range(len(bingo))]

ans1 = bingo[0]+bingo[1]+bingo[2] 
ans2 = bingo[3]+bingo[4]+bingo[5]
ans3 = bingo[6]+bingo[7]+bingo[8]
ans4 = bingo[0]+bingo[3]+bingo[6]
ans5 = bingo[1]+bingo[4]+bingo[7]
ans6 = bingo[2]+bingo[5]+bingo[8]
ans7 = bingo[0]+bingo[4]+bingo[8]
ans8 = bingo[2]+bingo[4]+bingo[6]

if ans1==0 or ans2==0 or ans3==0 or ans4==0 or ans5==0 or ans6==0 or ans7==0 or ans8==0:
  print('Yes')
else:
  print('No')



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0) break;
		vvi b(n,vi(3));
		vi c(n),d(3);
		for(int i=0;i<n;i++){
			string s;
			cin>>s;
			b[i]=d;
			for(auto j:s){
				if(j!='.') break;
				c[i]++;
			}
			for(auto j:s){
				if(j=='(') d[0]++;
				if(j=='{') d[1]++;
				if(j=='[') d[2]++;
				if(j==')') d[0]--;
				if(j=='}') d[1]--;
				if(j==']') d[2]--;
			}
		}
		d=vi(3);
		vi res(m);
/*		for(int i=0;i<n;i++){
			for(auto j:b[i]) cout<<j<<' ';
			cout<<endl;
		}*/
		for(int i=0;i<m;i++){
			string s;
			cin>>s;
			vi a;
			for(int x=1;x<=20;x++) for(int y=1;y<=20;y++) for(int z=1;z<=20;z++){
				bool B=1;
				for(int j=0;j<n;j++) if(x*b[j][0]+y*b[j][1]+z*b[j][2]!=c[j]) B=0;
				if(B) a.push_back(x*d[0]+y*d[1]+z*d[2]);
			}
			sort(a.begin(),a.end());
			a.erase(unique(a.begin(),a.end()),a.end());
			assert(!a.empty());
			if(a.size()>1) res[i]=-1;
			else res[i]=a[0];
			for(auto j:s){
				if(j=='(') d[0]++;
				if(j=='{') d[1]++;
				if(j=='[') d[2]++;
				if(j==')') d[0]--;
				if(j=='}') d[1]--;
				if(j==']') d[2]--;
			}
		}
		for(int i=0;i<m;i++){
			if(i) cout<<' ';
			cout<<res[i];
		}
		cout<<endl;
	}
}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int k;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>s>>k;
	s="#"+s; 
	for(int i=1;i<=n;i++){
		if(s[i]!=s[k])
			s[i]='*';
		cout<<s[i];
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

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

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n],cal[n];
    for(int i=0;i<n;i++){cal[i]=1e9+7;cin>>a[i];}
    cal[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j+k>=i && j>=0;j--){
            cal[i]=min(abs(a[i]-a[j])+cal[j],cal[i]);
        }
    }
    cout<<cal[n-1]<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;

int N;
llint x[200005], s[200005];
llint sum[200005], Max[200005];

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> x[i] >> s[i];
	}
	
	sum[0] = s[0];
	for(int i = 1; i < N; i++){
		sum[i] = sum[i-1] + s[i] - (x[i] - x[i-1]);
	}
	
	Max[N-1] = sum[N-1];
	for(int i = N-2; i >= 0; i--){
		Max[i] = max(Max[i+1], sum[i]);
	}
	
	llint ans = -inf;
	for(int i = 0; i < N; i++){
		ans = max(ans, Max[i] - sum[i] + s[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}

void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//

int main() {
	string S;
	cin >> S;
	N = S.length();
	vll dp(N+5, vl(13, 0));
	dp[0][0] = 1;
	for (i = 0; i < N; i++) {
		ll c;
		if (S[i] == '?') {
			c = -1;
		}
		else {
			c = ctoi(S[i]);
		}
		for (j = 0; j < 10; j++) {
			if (c != -1 && c != j) {
				continue;
			}
			for (k = 0; k < 13; k++) {
				dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
			}
		}
		for (j = 0; j < 13; j++) {
			dp[i + 1][j] %= MOD;
		}
	}
	cout << dp[N][5];
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long 
#define mod 1000000007
int b[10];
int main()
{
	int n;
	cin>>n;
	int a[n+10];
	int binno=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]>=1 && a[i]<=399)
		{
			b[0]++;
		}
		else if(a[i]>=400 && a[i]<=799)
		{
			b[1]++;
		}
		else if(a[i]>=800 && a[i]<=1199)
		{
			b[2]++;
		}
		else if(a[i]>=1200 && a[i]<=1599)
		{
			b[3]++;
		}
		else if(a[i]>=1600 && a[i]<=1999)
		{
			b[4]++;
		}
		else if(a[i]>=2000 && a[i]<=2399)
		{
			b[5]++;
		}
		else if(a[i]>=2400 && a[i]<=2799)
		{
			b[6]++;
		}
		else if(a[i]>=2800 && a[i]<=3199)
		{
			b[7]++;
		}
		else
		{
			binno++;
		}
	}
	int re=0;
	for(int i=0;i<=7;i++)
	{
		if(b[i]>0)
		{
			re++;
		}
	}
	cout<<max(1,re)<<" "<<re+binno<<endl;

}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define R(i,n) for(int i = 0; i < (n); i++)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class T> ostream &operator<<(ostream& os, set<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.FI << "," << P.SE << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

string s;
vector<pair<int,string>> licz(string x){
  debug(x);
  vector<pair<int,string>> res;
  R(i,1 << SZ(x)){
    string a,b;
    R(j,SZ(x))if((i >> j)&1){
      a += x[j];
    }else{
      b += x[j];
    }
    reverse(ALL(b));
    res.PB({SZ(a), a + b});
  }
  debug(res);
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  cin >> s;
  map<string,int> mapka[20];
  auto x = licz(s.substr(0,n));
  for(auto el:x){
    mapka[el.FI][el.SE]++;
  }
  string pol = s.substr(n);
  reverse(ALL(pol));
  x = licz(pol);
  int res = 0;
  for(auto el:x){
    res += mapka[el.FI][el.SE];
  }
  cout << res << "\n";
}




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

int main(void) {
    int A,B,C;cin>>A>>B>>C;
    if (A > B) swap(A, B);
    if (A > C) swap(A, C);
    if (B > C) swap(B, C);
    cout << A << " " << B << " " << C << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) 
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

const double PI = 3.1415926535897932384;

// 1次元vectorの出力
template <class S>
void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}

// 2次元vectorの出力
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int main(void){
	int k,a,b; cin >> k >> a >> b;
	cout << ((b/k > (a-1)/k) ? "OK" : "NG") << endl;
}

Measured memory_bytes: 3596