akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

typedef long long ll;

using namespace std;

int main(){

    ll n,m;
    cin >> n >> m;

    vector<ll> a;

    rep(i,n){
        ll tmp;
        cin >> tmp;

        a.pback(tmp);
    }

    sort(ALL(a));

    int ok = 0;
    int ng = 200001;

    while(abs(ok - ng) > 1){
        int tmp = (ok + ng) / 2;

        ll tmpcount = 0;

        rep(i, n){
            int leftp = a[i];
            int rightp = tmp - leftp;

            auto itr = lower_bound(ALL(a), rightp);
            int num = n - distance(a.begin(), itr);

            tmpcount += num;
        }

        if(tmpcount < m){
            ng = tmp;
        }else{
            ok = tmp;
        }
    }

    reverse(ALL(a));

    vector<ll> asum(1);

    rep(i,n){
        asum.pback(asum[i] + a[i]);
    }

    ll ans = 0;

    reverse(ALL(a));

    ll count = 0;

    rep(i,n){
        ll left = a[i];
        ll rightp = ok - left;

        auto itr = lower_bound(ALL(a), rightp);
        ll num = n - distance(a.begin(), itr);

        count += num;

        ans += num * left + asum[num];

    }

    ans -= ok * (count - m);

    cerr << ok << endl;
    cerr << count << endl;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2548
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    happiness = [[] for _ in range(N)]
    for i in range(N):
        happiness[i] = LI()

    result = [[0 for _ in range(3)] for _ in range(N)]
    result[0] = happiness[0]
    for day in range(1,N):  # 10**5   : 夏休みが 10**5 日もある！ 人生は3万日しかない。
        result[day][0] = max(result[day-1][1] + happiness[day][0], result[day-1][2] + happiness[day][0])
        result[day][1] = max(result[day-1][0] + happiness[day][1], result[day-1][2] + happiness[day][1])
        result[day][2] = max(result[day-1][0] + happiness[day][2], result[day-1][1] + happiness[day][2])

    print(max(result[N-1]))

main()

Measured memory_bytes: 45684
#include <iostream>
#include <map>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  int n, m;
  cin >> n;
  string s;
  map<string, int> mp;
  rep(i, n){
    cin >> s;
    mp[s]++;
  }
  cin >> m;
  rep(i, m){
    cin >> s;
    mp[s]--;
  }
  int ans = 0;
  for(auto a: mp){
    ans = max(ans, a.second);
  }
  cout << ans << endl;
}



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

def list_n():
    return [int(e) for e in input().split()]



def main(a, b, c):
    if b - a == c - b:
        return 'YES'
    else:
        return 'NO'

if __name__ == '__main__':
    a, b, c = list_n()
    print(main(a, b, c))


Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
ll a[200010];
int main(){
    cin>>N;
	for(ll i=0;i<N;i++){
		cin>>a[i];
	}
	ll ans=0;
	if(a[0]!=0){
		cout<<-1;
		return 0;
	}
	for(ll i=0;i<N-1;i++){
		if(a[i]+1<a[i+1]){
			cout<<-1;
			return 0;
		}
		if(a[i]+1==a[i+1]){
			ans++;
		}else{
			ans+=a[i+1];
		}
	}
	cout<<ans;
    return 0;
}

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

int main(){
    int n,a[10005]={},cnt=0;
    bool flag=true;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a[i];
        while(a[i]%2==0){
            cnt++;
            a[i]/=2;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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

int isPrime(int a) {
    for (int i = 2; i * i <= a; ++i) {
        if (a % i == 0) {
            return 0;
        }
    }
    return 1;
}


void oneCase () {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << "\n";
}





int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int s[2020][2020];
int a[2020][2020], b[2020][2020], c[2020][2020];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, m, q;
  cin >> n >> m >> q;
  rep(i, n) rep(j, m) {
    char c;
    cin >> c;
    s[i][j] = c - '0';
  }

  rep(i, n) rep(j, m) {
    a[i + 1][j + 1] = s[i][j] + a[i + 1][j] + a[i][j + 1] - a[i][j];
    b[i + 1][j + 1] = (s[i][j] && s[i + 1][j]) + b[i + 1][j] + b[i][j + 1] - b[i][j];
    c[i + 1][j + 1] = (s[i][j] && s[i][j + 1]) + c[i + 1][j] + c[i][j + 1] - c[i][j];
  }

  while (q--) {
    int i, j, k, l;
    cin >> i >> j >> k >> l;
    i--, j--;

    int ans = 0;
    ans += a[k][l] - a[i][l] - a[k][j] + a[i][j];
    //cout << ans << '\n';
    ans -= b[k - 1][l] - b[i][l] - b[k - 1][j] + b[i][j];
    //cout << ans << '\n';
    ans -= c[k][l - 1] - c[i][l - 1] - c[k][j] + c[i][j];
    cout << ans << '\n';
  }





  




  
  return 0;
}

Measured memory_bytes: 66808
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>
 
#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>
 
#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}
 
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int N = 1010, M = 2010, P = 1000000007, L = 10;

int n, m;
ll x;
int f[N], dep[N];
bool vis[N];
int p[N][L], mx[N][L];
pair<int, pair<int, int>> e[M];
vector<pair<int, int>> g[N];

int mpow(int x, int k) {
  int ret = 1;
  while (k) {
    if (k & 1)
      ret = ret * (ll)x % P;
    x = x * (ll)x % P;
    k >>= 1;
  }
  return ret;
}

int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }

void dfs(int u) {
  vis[u] = true;
  for (int i = 1; i < L; ++i)
    p[u][i] = p[p[u][i - 1]][i - 1];
  for (int i = 1; i < L; ++i)
    mx[u][i] = max(mx[u][i - 1], mx[p[u][i - 1]][i - 1]);
  for (const auto& pr : g[u]) {
    int v, w;
    tie(v, w) = pr;
    if (!vis[v]) {
      dep[v] = dep[u] + 1;
      p[v][0] = u;
      mx[v][0] = w;
      dfs(v);
    }
  }
}

int qry(int u, int v) {
  int ret = 0;
  if (dep[u] > dep[v])
    swap(u, v);
  for (int i = L - 1; i >= 0; --i)
    if ((dep[v] - dep[u]) >> i & 1) {
      ret = max(ret, mx[v][i]);
      v = p[v][i];
    }
  if (u == v)
    return ret;
  for (int i = L - 1; i >= 0; --i)
    if (p[u][i] != p[v][i]) {
      ret = max({ret, mx[u][i], mx[v][i]});
      u = p[u][i];
      v = p[v][i];
    }
  return max({ret, mx[u][0], mx[v][0]});
}

#define U second.first
#define V second.second
#define W first

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

  cin >> n >> m >> x;
  for (int i = 1; i <= m; ++i)
    cin >> e[i].U >> e[i].V >> e[i].W;
  sort(e + 1, e + m + 1);
  iota(f + 1, f + n + 1, 1);
  ll mst = 0;
  for (int i = 1; i <= m; ++i) {
    int x = find(e[i].U), y = find(e[i].V);
    if (x != y) {
      mst += e[i].W;
      f[x] = y;
      g[e[i].U].emplace_back(e[i].V, e[i].W);
      g[e[i].V].emplace_back(e[i].U, e[i].W);
    }
  }
  dfs(1);
  int ans;
  if (mst == x) {
    int a = 0;
    for (int i = 1; i <= m; ++i)
      if (e[i].W == qry(e[i].U, e[i].V))
        ++a;
    ans = (mpow(2, a) + P - 2LL) * mpow(2, m - a) % P;
  } else if (mst < x) {
    int a = 0, b = 0;
    for (int i = 1; i <= m; ++i) {
      ll val = mst - qry(e[i].U, e[i].V) + e[i].W;
      if (val < x)
        ++a;
      else if (val == x)
        ++b;
    }
    ans = (mpow(2, b) + P - 1LL) * mpow(2, m - a - b) % P * 2 % P;
  } else
    ans = 0;
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 512
import std.stdio,std.string,std.conv;

immutable MAX = 2000000000;

int main(string[] argv)
{
    char[] buf;
	string[] ans;
	while(stdin.readln(buf)){
		if(buf.split(" ").length == 2){
			uint a = buf.chomp().split(" ")[0].to!int();
			uint b = buf.chomp().split(" ")[1].to!int();
			uint g = GCD(a,b);
			ulong l = LCM(a,b,g);
			if(l < MAX){
				ans ~= g.to!string ~ " " ~ l.to!string();
			}
		}
	}

	foreach(string str;ans){
		writeln(str);
	}

    return 0;
}

private int GCD(int a,int b){

	while(a != b){
		if(a < b){
			int tmp = b;
			b = a;
			a = tmp;
		}
		int tmp = b;
		b = a - b;
		a = tmp;
	}

	return a;
}

private ulong LCM(int a,int b,int g){
	return ((a/g) * (b/g))*g;
}

Measured memory_bytes: 2512
/*
@Author
   Sujeet Kushwaha
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
// ll powmod(ll a, ll b)
// {
//     ll res = 1;
//     while (b) {
//         if (b&1) {
//             res *= a;
//             res %= mod;
//         }
//         b >>= 1;
//         a = (a * a) % mod;
//     }

//     return res;
// }

// ll modInv(ll a)
// {
//     return powmod(a, mod - 2);
// }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
ll isprime(ll n)
{
  if(n==1)
    return 0;
  for(int i=2;i*i<=n;i++)
  {
     if(n%i==0)
     {
       return 0;
     }
  }
  return 1;
}
void solve()
{
  ll x;
  cin>>x;
  ll ans;
  for(int i=x;i<=10000000;i++)
  {
    if(isprime(i)==1)
    {
      ans=i;
      break;
    }
  }
  cout<<ans;
}
int main() {
	fast;
	fast_input;
	fast_output;
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	  solve();
	// }
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();

		String[] strAry = str.split(" ");
		int[] intAry = new int[5];

		int w = Integer.parseInt(strAry[0]);
		int h = Integer.parseInt(strAry[1]);
		int x = Integer.parseInt(strAry[2]);
		int y = Integer.parseInt(strAry[3]);
		int r = Integer.parseInt(strAry[4]);

		if( x-r >= 0 && y-r >= 0 && x+r <= w && y+r <= h) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 24436
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i, h){
        cin >> a[i];
    }
    rep(i, h){
        bool flag = true;
        rep(j, w){
            if(a[i][j] != '.'){
                flag = false;
                break;
            }
        }
        if(flag){
            a.erase(a.begin() + i);
            i--;
            h--;
        }
    }
    rep(j, w){
        bool flag = true;
        rep(i, h){
            if(a[i][j] != '.'){
                flag = false;
                break;
            }
        }
        if(flag){
            rep(i, h){
                a[i].erase(a[i].begin() + j);
            }
            j--;
            w--;
        }
    }
    rep(i, h){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
int N;
long double X[1<<17],Y[1<<17];
char D[1<<17];
long double calc(long double v)
{
	long double xm=1e18,xM=-1e18,ym=1e18,yM=-1e18;
	for(int i=0;i<N;i++)
	{
		xm=min(xm,v*(D[i]=='L'?-1:D[i]=='R')+X[i]);
		xM=max(xM,v*(D[i]=='L'?-1:D[i]=='R')+X[i]);
		ym=min(ym,v*(D[i]=='D'?-1:D[i]=='U')+Y[i]);
		yM=max(yM,v*(D[i]=='D'?-1:D[i]=='U')+Y[i]);
	}
	return(xM-xm)*(yM-ym);
}
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>X[i]>>Y[i]>>D[i];
	long double L=0,R=1e18;
	for(int i=0;i<300;i++)
	{
		if(calc((L*2+R)/3)<calc((L+R*2)/3))R=(L+R*2)/3;
		else L=(L*2+R)/3;
	}
	cout<<fixed<<setprecision(16)<<calc(L)<<endl;
}

Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int n;
  double ans;
  cin >> n;
  for(int i = 0; i< n; i++) {
    string s;
    double m;
    cin >> m >> s;
    if(s == "JPY") ans += m;
    else ans += m * 380000;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, a, b, c;
	scanf("%d %d %d %d", &n, &a, &b, &c);
	int i;
	char s[100005][4];
	for (i = 0; i < n; i++)
		scanf("%s", s[i]);
	int f = 0;
	int ans[100005];
	if (s[0][0] == 'A' && s[0][1] == 'B' && a == 0 && b == 0)
		f++;
	if (s[0][0] == 'A' && s[0][1] == 'C' && a == 0 && c == 0)
		f++;
	if (s[0][0] == 'B' && s[0][1] == 'C' && b == 0 && c == 0)
		f++;
	if (f > 0)
	{
		printf("No\n");
		return 0;
	}
	if (a + b + c == 0)
	{
		printf("No\n");
		return 0;
	}
	if (a + b + c > 2)
	{
		for (i = 0; i < n; i++)
		{
			if (s[i][0] == 'A' && s[i][1] == 'B')
			{
				if (a > b)
				{
					ans[i] = 1;
					a--;
					b++;
				}
				else
				{
					ans[i] = 0;
					a++;
					b--;
				}
			}
			else if (s[i][0] == 'A' && s[i][1] == 'C')
			{
				if (a > c)
				{
					ans[i] = 2;
					a--;
					c++;
				}
				else
				{
					ans[i] = 0;
					a++;
					c--;
				}
			}
			else if (s[i][0] == 'B' && s[i][1] == 'C')
			{
				if (b > c)
				{
					ans[i] = 2;
					b--;
					c++;
				}
				else
				{
					ans[i] = 1;
					b++;
					c--;
				}
			}
		}
		printf("Yes\n");
		for (i = 0; i < n; i++)
			printf("%c\n", ans[i] + 'A');
		return 0;
	}
	if (a + b + c == 1)
	{
		f = 0;
		for (i = 0; i < n; i++)
		{
			if (s[i][0] == 'A' && s[i][1] == 'B')
			{
				if (a > 0)
				{
					ans[i] = 1;
					b++;
					a--;
				}
				else if (b > 0)
				{
					ans[i] = 0;
					a++;
					b--;
				}
				else
					f++;
			}
			else if (s[i][0] == 'A' && s[i][1] == 'C')
			{
				if (a > 0)
				{
					ans[i] = 2;
					c++;
					a--;
				}
				else if (c > 0)
				{
					ans[i] = 0;
					a++;
					c--;
				}
				else
					f++;
			}
			else
			{
				if (b > 0)
				{
					ans[i] = 2;
					c++;
					b--;
				}
				else if (c > 0)
				{
					ans[i] = 1;
					b++;
					c--;
				}
				else
					f++;
			}
		}
		if (f > 0)
			printf("No\n");
		else
		{
			printf("Yes\n");
			for (i = 0; i < n; i++)
				printf("%c\n", ans[i] + 'A');
		}
		return 0;
	}
	s[n][0] = 'A';
	s[n][1] = 'C';
	for (i = 0; i < n; i++)
	{
		if (s[i][0] == 'A' && s[i][1] == 'B')
		{
			if (a > b)
			{
				ans[i] = 1;
				b++;
				a--;
			}
			else if (a < b)
			{
				ans[i] = 0;
				a++;
				b--;
			}
			else
			{
				if (s[i + 1][0] == 'A')
				{
					ans[i] = 0;
					a++;
					b--;
				}
				else
				{
					ans[i] = 1;
					b++;
					a--;
				}
			}
		}
		else if (s[i][0] == 'A')
		{
			if (a < c)
			{
				ans[i] = 0;
				a++;
				c--;
			}
			else if (a > c)
			{
				ans[i] = 2;
				c++;
				a--;
			}
			else
			{
				if (s[i + 1][0] == 'A')
				{
					ans[i] = 0;
					a++;
					c--;
				}
				else
				{
					ans[i] = 2;
					c++;
					a--;
				}
			}
		}
		else
		{
			if (b < c)
			{
				ans[i] = 1;
				b++;
				c--;
			}
			else if (b > c)
			{
				ans[i] = 2;
				c++;
				b--;
			}
			else
			{
				if (s[i + 1][1] == 'C')
				{
					ans[i] = 2;
					c++;
					b--;
				}
				else
				{
					ans[i] = 1;
					b++;
					c--;
				}
			}
		}
	}
	printf("Yes\n");
	for (i = 0; i < n; i++)
		printf("%c\n", ans[i] + 'A');
	return 0;
}

Measured memory_bytes: 2512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long int
#define mod 1000000007
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int n, a[100005], d[100005];
vector<int> g[100005];
queue<int> q;

void DFS(int i) {
    vector<int> v;
    for (int j = 0; j < g[i].size(); j++) DFS(g[i][j]), v.push_back(d[g[i][j]]);
    sort(v.begin(), v.end());
    int m = 0;
    for (int j = 0; j < v.size(); j++) m = max(m, v[j] + (int)v.size() - j);
    d[i] = m;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    fr1(n - 1) cin >> a[i + 1], g[a[i + 1]].push_back(i + 1);
    DFS(1);
    //fr1(n) cout << d[i] << ' ';
    cout << d[1] << '\n';
    /*fr1(n) if (!g[i].size()) q.push(i);
    while (!q.empty()) {
        int b = q.front();
        cout << b << ' ';
        q.pop();
        if (a[b]) q.push(a[b]);
        d[a[b]] = max(d[b], d[a[b]]) + 1;
        fr1(n) cout << d[i] << ' ';
        cout << '\n';
    }*/
}

Measured memory_bytes: 14336
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
  int A, B;
  cin >> A >> B;
  if (A == 0) {
    cout << "! " << string(B, '0') << endl;
    return 0;
  }
  if (A <= B) {
    cout << "Impossible" << endl;
    return 0;
  }
  const int N = A + B;
  int honest = 0, y = 0, n = 0;
  for (int i = 1; i < N; ++i) {
    cout << "? " << i << " " << honest << endl;
    string s;
    cin >> s;
    if (s == "Y") ++y;
    else ++n;
    if (n > y) {
      ++i;
      honest = i;
      y = 0; n = 0;
    }
  }
  vector<int> res(N);
  res[honest] = 1;
  REP(i,N) {
    if (i == honest) continue;
    cout << "? " << honest << " " << i << endl;
    string s;
    cin >> s;
    if (s == "Y") res[i] = 1;
    else res[i] = 0;
  }
  cout << "! ";
  REP(i,N) cout << res[i];
  cout << endl;
  return 0;
}


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

using namespace std;

#define ll long long
#define ar array

string s,t;



void solve(){
    
    cin >> s >> t;
    int l = s.length();

    int ans = 0;
    for (int i = 0; i < l; i++)
    {
        if(s.at(i) != t.at(i)) ans++;
    }
    
    cout << ans << endl;
}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 3744
import sys
#input = sys.stdin.buffer.readline

def main():
    s = str(input())
    N = len(s)
    pl = [0 for _ in range(N+1)]
    ml = [0 for _ in range(N+1)]
    for i in range(N):
        if s[i] == "<":
            pl[i+1] = pl[i]+1
        if s[-i-1] == ">":
            ml[-i-2] = ml[-i-1]+1

    ans = 0
    for i in range(N+1):
        ans += max(pl[i],ml[i])
    
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 27964
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

int dp[3005][3005][5];
int val[3005][3005];

class EPickingGoods {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        CLR(dp, -1);
        int R, C, K;
        cin >> R >> C >> K;
        REP(i, K) {
            int r, c, v;
            cin >> r >> c >> v;
            r--, c--;
            val[r][c] = v;
        }

        dp[0][0][0] = 0;
        REP(i, R) {
            REP(j, C) {
                REP(k, 4) {
                    if (dp[i][j][k] == -1) continue;
                    // 拾わない
                    if (i + 1 < R) dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k]);
                    if (j + 1 < C) dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);

                    // 拾う
                    if (k < 3) {
                        if (i + 1 < R) dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k] + val[i][j]);
                        if (j + 1 < C) dp[i][j + 1][k + 1] = max(dp[i][j + 1][k + 1], dp[i][j][k] + val[i][j]);
                    }
                }
            }
        }

        int res = 0;
        REP(i, 4) {
            int tmp = dp[R - 1][C - 1][i];
            if (i < 3) tmp += val[R-1][C-1];
            res = max(res, tmp);
        }
        cout << res << endl;
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EPickingGoods solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 426816
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long  ull;

#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define sz(x) int (x.size());
//typedef pair<int,int> P;

using namespace std;
const int MOD=1000000007;
const int INF=1001001001;

int main(){
  string s;
  int q;
  cin>>s;cin>>q;
  vector<char> vf,vb;
  int cnt=0;
  rep(i,q){
    int k;
    cin>>k;
    if (k==1){
      cnt++;
      swap(vf,vb);
    }
    if (k==2){
      int f;char c;
      cin>>f>>c;
      if (f==1)vf.emplace_back(c);
      if (f==2)vb.emplace_back(c);
    }
  }
  if (cnt%2==1) reverse(s.begin(),s.end());
  string ans;
  while(vf.size()>0){
    char cnow=vf.back();
    vf.pop_back();
    ans.push_back(cnow);
  }
  ans.append(s);
  reverse(vb.begin(),vb.end());
  while(vb.size()>0){
    char cnow=vb.back();
    vb.pop_back();
    ans.push_back(cnow);
  }
  cout<<ans;


}


Measured memory_bytes: 1368
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inf        10000000005


int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    forn(i,n)
    cin>>a[i];
    ll dp[200005];
    forn(i,n)
    dp[i]=inf;
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<=i+k;j++)
        {
            if(j<n)
            dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <memory.h>
int main(void){
    int num,start,end,i,line[50];
    for(;memset(line,0,sizeof(line)),i=1,scanf("%d",&num),num;){
        for(i=0;i<num;i++)
            scanf("%d",&line[i]);
        start=end=line[0];
        i=0;
        while(i<=num){
            if(end+1==line[i])
                end++;
            if(end!=line[i] || i==num){
                if(start==end)
                    printf("%d%s",start,i==num?"\n":" ");
                else
                    printf("%d-%d%s",start,end,i==num?"\n":" ");
                start=end=line[i];
            }
            i++;
        }
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int64_t gcd(int64_t a,int64_t b) {
    if(a < b) {
        swap(a,b);
    }
    while(b != 0) {
        int64_t tmp = a;
        a = b;
        b = tmp % b;
    }
    return a;
}

int main() {
    int64_t n,x;
    cin >> n >> x;
    vector<int64_t> dx(n);
    int64_t d;
    for(int i = 0;i < n;i++) {
        cin >> d;
        dx.at(i) = abs(x - d);
    }
    if(n == 1) {
        cout << dx.at(0) << endl;
    }else {
        int64_t g = dx.at(0);
        for(int i = 0;i < n - 1;i++) {
            g = gcd(g,dx.at(i + 1));
        }
        cout << g << endl;
    }
}

Measured memory_bytes: 1024
using System;
using System.IO;

class Program{
    static void Main(string[] args){
        var arr = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long N = arr[0], K = arr[1];
        var answer = N;
        if (N % K == 0) answer = 0;
        else { long mod = N % K, abs = Math.Abs(mod - K); answer = mod < abs ? mod : abs; }
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27524
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 500005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vector<pii> queries;
int bit[MAX];
int n, q, arr[MAX], ans[MAX];

bool compare(pii x, pii y)
{
    return x.ss.ss < y.ss.ss;
}

void update(int idx, int val)
{
    for (; idx <= n; idx += idx&-idx)
        bit[idx] += val;
}

int query(int idx)
{
    int sum = 0;
    for (; idx>0; idx-=idx&-idx)
        sum += bit[idx];

    return sum;
}

void solve()
{
    memset(bit, 0, sizeof(bit));

    int visitIdx[MAX];
    memset(visitIdx, -1, sizeof(visitIdx));

    int k = 0;
    for (int i=0; i<n; i++)
    {
        if (visitIdx[arr[i]] !=-1)
            update (visitIdx[arr[i]] + 1, -1);

        visitIdx[arr[i]] = i;
        update(i + 1, 1);

        while (k < q && queries[k].ss.ss == i)
        {
            ans[queries[k].ff] = query(queries[k].ss.ss + 1) - query(queries[k].ss.ff);
            k++;
        }
    }
}

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

    cin>>n>>q;
    for(int i = 0; i < n; i++) {
        cin>>arr[i];
    }

    for(int i = 0; i < q; i++) {
        int u, v;
        cin>>u>>v;
        u--, v--;
        queries.pb(mk(i, mk(u, v)));
    }

    sort(queries.begin(), queries.end(), compare);

    solve();

    for(int i = 0; i < q; i++) {
        cout<<ans[i]<<endl;
    }

    return 0;
}



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

int main()
{
  int R; cin >> R;
  if( R < 1200){
    cout <<"ABC"<< endl;
  }
  else if(R >= 1200 && R < 2800){
    cout <<"ARC"<< endl;
  }
  else {
    cout <<"AGC"<< endl;
  }
}


Measured memory_bytes: 256
def bitcount(N):  # 立ってるbitの数
    bitcnt = [0]
    for _ in range(N):
        bitcnt += [i + 1 for i in bitcnt]
    return bitcnt


n, x = int(input()), input()

num, cnt = int(x, 2), x.count('1')
num0, num1 = num % (cnt + 1), num % max(cnt - 1, 1)
lbit = bitcount(18)
for i in range(n):
    ans = 1
    if x[i] == '0':
        ctmp = cnt + 1
        tmp = num0 + pow(2, n - (i + 1), cnt + 1)
    elif x[i] == '1':
        if cnt == 1:
            print(0)
            continue
        ctmp = cnt - 1
        tmp = num1 - pow(2, n - (i + 1), cnt - 1)
    tmp %= ctmp
    ctmp = lbit[tmp]
    while tmp > 0:
        ans += 1
        tmp %= ctmp
        ctmp = lbit[tmp]
    print(ans)


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

#define MAX 100010
int N,M,C,l[MAX], c[MAX], w[MAX];
struct Data {
  int color, weight;
  bool operator < ( const Data &data ) const {
    if( weight != data.weight ) return weight < data.weight;
    return color < data.color;
  }
};

int main() {
  cin >> N >> M >> C;
  rep(i,C) cin >> l[i];
  priority_queue<Data> Q;
  rep(i,N) {
    cin >> c[i] >> w[i];
    --c[i];
    Q.push((Data){c[i],w[i]});
  }
  int score = 0;
  while( M > 0 && !Q.empty() ) {
    Data d = Q.top(); Q.pop();
    if( l[d.color] > 0 ) {
      l[d.color]--;
      --M;
      score += d.weight;
    }
  }
  cout << score << endl;
  compute();
  return 0;
}



Measured memory_bytes: 4720
import sys
input = sys.stdin.readline
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1 , np.int64)


for i in range(N):
    w,v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:] , dp[:-w] + v)

print(dp[-1])

Measured memory_bytes: 15476
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let k: usize = scan(tokens);
    let c: usize = scan(tokens);
    let s: String = scan(tokens);
    let s: Vec<bool> = s.chars().map(|c| c == 'x').collect();
    let l: Vec<usize> = {
        let mut l = vec![0; n];
        let mut i = 0;
        let mut j = 0;
        while i < k {
            while s[j] {
                j += 1;
            }
            i += 1;
            l[j] = i;
            j += c + 1;
        }
        l
    };
    let r: Vec<usize> = {
        let mut r = vec![0; n];
        let mut i = k;
        let mut j = n - 1 + c + 1;
        while i > 0 {
            j -= c + 1;
            while s[j] {
                j -= 1;
            }
            r[j] = i;
            i -= 1;
        }
        r
    };
    for i in 0..n {
        if l[i] != 0 && l[i] == r[i] {
            println!("{}", i + 1);
        }
    }
}


Measured memory_bytes: 9596
import sys
import bisect
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
inf = 10**18
mod = 998244353


class SegmentTree:
    def __init__(self, N, arr=None, op=None, unit=None):
        """
        INPUT
        N: 配列のサイズ
        segment tree: 1-indexedで構築
        original array: 0-indexed
                 1
           2           3
         4    5     6     7
        8 9 10 11 12 13 14 15
        ---------------------
        0 1 2  3  4  5  6  7
        """
        self.N = N
        self.unit = unit
        self.op = op
        self.tree = [unit] * (2 * N + 1)
        if arr is not None:
            self._build(arr)

    def _build(self, arr):
        op = self.op
        N = self.N
        for i, a in enumerate(arr, N):
            self.tree[i] = a
        for i in reversed(range(1, N)):
            self.tree[i] = op(self.tree[i << 1], self.tree[i << 1 | 1])

    def update(self, i, x):
        """
        arr[i]の値をxに変更する
        i: 0-indexed
        """
        i += self.N
        op = self.op
        self.tree[i] = x
        while i > 1:
            i >>= 1
            self.tree[i] = op(self.tree[i << 1], self.tree[i << 1 | 1])

    def val(self, i):
        return self.tree[i + self.N]

    def query(self, L, R):
        """
        L,R: 0-indexed
        半開区間[L,R)の累積演算した値を返す
        """
        op = self.op
        res = self.unit
        L += self.N
        R += self.N
        while L < R:
            if L & 1:
                res = op(res, self.tree[L])
                L += 1
            if R & 1:
                R -= 1
                res = op(res, self.tree[R])
            L >>= 1
            R >>= 1
        return res


N = int(input())
XD = list(tuple(map(int, input().split())) for _ in range(N))
XD.sort()
X, D = zip(*XD)
X += (inf, )


seg = SegmentTree(N+1, None, max, 0)
for L in reversed(range(N)):
    R = bisect.bisect_left(X, X[L] + D[L])
    p = seg.query(L, R)
    seg.update(L, max(L, p))

dp = [0] * (N + 1)
dp[-1] = 1
for i in reversed(range(N)):
    p = seg.val(i)
    dp[i] = (dp[i + 1] + dp[p + 1]) % mod

print(dp[0])

Measured memory_bytes: 123912
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}xy;

void kock( int, xy, xy );

int main()
{
  xy s1, s2;
  int h;

  s1.x = 0;
  s1.y = 0;
  s2.x = 100;
  s2.y = 0;

  scanf("%d", &h);
  printf("%.8f %.8f\n", s1.x, s1.y);
  kock( h, s1, s2 );
  printf("%.8f %.8f\n", s2.x, s2.y);

  return 0;
}



void kock( int h, xy s1, xy s2 )
{
  xy a, b, c;
  
  if( h == 0 ) return;
  
  a.x = ((2*s1.x)+(1*s2.x)) / 3;
  a.y = ((2*s1.y)+(1*s2.y)) / 3;
  b.x = ((1*s1.x)+(2*s2.x)) / 3;
  b.y = ((1*s1.y)+(2*s2.y)) / 3;
  
  c.x = (b.x-a.x)*cos(M_PI/3.0) - (b.y-a.y)*sin(M_PI/3.0) + a.x;
  c.y = (b.x-a.x)*sin(M_PI/3.0) + (b.y-a.y)*cos(M_PI/3.0) + a.y;
  

  kock(h-1, s1, a);
  printf("%.8f %.8f\n", a.x, a.y);
  kock(h-1, a, c);
  printf("%.8f %.8f\n", c.x, c.y);
  kock(h-1, c, b);
  printf("%.8f %.8f\n", b.x, b.y);
  kock(h-1, b, s2);

}



Measured memory_bytes: 2108
import sys
s=list(input())
o=s[::2]
e=s[1::2]

for i in range(len(o)):
  if o[i]=='L':
    print('No')
    sys.exit() 
for i in range(len(e)):
  if e[i]=='R':
    print('No')
    sys.exit()
print('Yes')

Measured memory_bytes: 3060
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main(){

    int n; SCD(n);
    vi A(n);
    int m = 0;
    REP(i, n) {
        SCD(A[i]);
        m = max(m, A[i]);
    }

    int a = m;
    if( a%2 == 1 ) a++;
    a /= 2;
    int b = 0;
    REP(i, n) {
        if( abs(A[i]-a)<abs(b-a) ) b = A[i];
    }

    /*
    ll d = 0; int a = 0, b = 0;
    for(int i=1; i<n; ++i){
        int z = 0; if(A[i]%2==1) ++z;
        for(int j=0; j<i; ++j){
            if( abs((A[i]+z)/2-A[j]) < abs((A[i]+z)/2-B[i]) ) B[i] = A[j]; 
        }
        if(A[i]-B[i] >= d ) {
            d = A[i]-B[i];
            a = A[i]; b = B[i];
        }
        
    }
    */
    if( n == 2 ) cout << A[0] << " " << A[1] << endl;
    else cout << m << " " << b << endl;

    return 0;
}


Measured memory_bytes: 640
from fractions import gcd


def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


A, B = map(int, input().split())

print(len(prime_factorize(gcd(A, B))) + 1)


Measured memory_bytes: 5172
def main():
	c = []
	
	for _ in range(3):
		c.append(list(map(int, input().split())))

	a = [0] * 3
	b = [0] * 3

	for i in range(3):
		b[i] = c[0][i] - a[0]

	for i in range(1, 3):
		a[i] = c[i][0] - b[0]
	
	is_able = True

	for i in range(3):
		for j in range(3):
			if a[i] + b[j] != c[i][j]:
				is_able = False
				break

	if is_able:
		print("Yes")
	else:
		print("No")

  
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9224
n = int(input())
array = list(map(int, input().split()))
sum = sum(array)
answer = 0
from collections import deque
d = deque(array)
for i in range(n):
    a = d.popleft()
    sum -= a
    answer += a*sum
    answer %= 10**9 + 7
print(answer)

Measured memory_bytes: 31620
#include<iostream>
using namespace std;
int main(){
  int n,sum=0,i;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(i=1;i<n-1;i++){
    if((a[i]>a[i-1] and a[i]<a[i+1])||(a[i]<a[i-1] and a[i]>a[i+1]))
      sum++;
  }
  cout<<sum;
  return 0;
}

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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int A,B;

	cin >> A >> B;

	if(A>=10 || B>=10)
	{
		cout << -1 << '\n';
	}
	else
	{
		cout << A*B << '\n';
	}
	
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define Maxn 4010

int R, C, K, x, y, z, cost[Maxn][Maxn];
long long f[Maxn][Maxn][4];

int main()
{
	scanf("%d%d%d", &R, &C, &K);
	for (int i=1; i<=K; i++)
	{
		scanf("%d%d%d", &x, &y, &z);
		cost[x][y]=z;
	}
	for (int i=1; i<=R; i++)
		for (int j=1; j<=C; j++)
		{
			for (int k=0; k<=3; k++) f[i][j][0]=max(f[i][j][0], f[i-1][j][k]);
			for (int k=0; k<=3; k++) f[i][j][k]=max(f[i][j][k], f[i][j-1][k]);
			if (cost[i][j])
			{ 
				for (int k=0; k<=3; k++) f[i][j][1]=max(f[i][j][1], f[i-1][j][k]+cost[i][j]);
				for (int k=0; k<3; k++) f[i][j][k+1]=max(f[i][j][k+1], f[i][j-1][k]+cost[i][j]);
			}
		}
	long long Res=0; for (int i=0; i<=3; i++) Res=max(Res, f[R][C][i]);
	printf("%lld\n", Res);
}

Measured memory_bytes: 342520
#include<iostream>
using namespace std;
long long calm(long long x)
{
    long long ret=1;
    for(int i=1;i<=5;i++)
        ret*=x;
    return ret;
}
long long x;
long long a[4005];
long long b[4005];
int main()
{
    for(int i=0;i<=3800;i++)
        a[i]=b[i]=calm(i);
    cin>>x;
    for(int i=0;i<=3800;i++)
    {
        for(int j=0;j<=3800;j++)
        {
            if(a[i]-b[j]==x)
            {
                cout<<i<<' '<<j;
                return 0;
            }
            if(a[i]+b[j]==x)
            {
                cout<<i<<" -"<<j;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3264
#include"bits/stdc++.h"
using namespace std;
#define rep(i, N) for(int i=0; i<N; ++i)

int main() {
    int a, b;
    cin >> a >> b;
    if (a < 1 | a > 9) cout << -1;
    else if (b < 1 | b > 9) cout << -1;
    else cout << a * b;
    return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
a = [input() for i in range(h)]
for i in range(h):
  b = ""
  for j in range(w):
    if a[i][j] == "#":
      b += "#"
    else:
      b += str(sum(k[max(0, j-1):min(w, j+2)].count("#") for k in a[max(0, i-1):min(h, i+2)]))
  print(b)

Measured memory_bytes: 9184
N, H = map(int, input().split())
a, b = [0] * N, [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())
ma = max(a)
b.sort(reverse=True)
ans = 0
index = 0
while H > 0 and len(b) > index and b[index] > ma:
    H -= b[index]
    index += 1
    ans += 1
if H > 0:
    ans += (H + ma - 1) // ma
print(ans)


Measured memory_bytes: 46168
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <bitset>
#include <list>
#include <map>
// #include <memory>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

int32_t main(){
  size_t n; cin>>n;
  bitset<20*2000> bit=1;
  uint32_t tmp;
  for(size_t i=0; i<n; ++i){
    cin>>tmp;
    bit|=bit<<tmp;
  }
  size_t q; cin>>q;
  for(size_t i=0; i<q; ++i){
    cin>>tmp;
    cout<<(bit[tmp]?"yes\n":"no\n");
  }
}


Measured memory_bytes: 3028
// C.

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <map>

using namespace std;

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	map<int, int> m;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		m[a - 1] += 1;
		m[a] += 1;
		m[a + 1] += 1;
	}
	int ans = 0;
	for (auto kv : m) {
		ans = max(ans, kv.second);
	}
	cout << ans << endl;
	return 0;
}


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

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

void Main() {
  string S;
  cin >> S;

  long long mod[2019];
  memset(mod, 0, sizeof(mod));
  mod[0] = 1;
  long long tmp = 0;
  for (int i = S.length() - 1; i >= 0; i--) {
    tmp = (tmp + modpow(10, S.length() - i - 1, 2019) * (S[i] - '0')) % 2019;
    mod[tmp]++;
  }

  /*
  for (int i = 0; i < 2019; i++) {
    if (mod[i]) cout << i << " " << mod[i] << endl;
  }
  return;
  */

  long long ans = 0;
  for (int i = 0; i < 2019; i++) {
    ans += mod[i] * (mod[i] - 1) / 2;
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n;
int arr[100001];
int brr[32]={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};
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>n;
    cout<<brr[n-1];
    return 0;
    for (int i=1;i<=n;i++){
        cin>>arr[i];
    }

}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif


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

    ll N; cin >> N;
    vl A(5); REP(i, 5) cin >> A[i];

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

    ll ans = 5 + (N + A[0] - 1) / A[0] - 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;

int main() {
    // input, ready
    map<int,pii> card;
    map<int,int> hit;
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            int a;
            cin >> a;
            hit[a]++;
            card[a] = {i,j};
        }
    }
    int N;
    cin >> N;
    vector<vector<bool>> bingo_check(3);
    for (int i=0; i<3; i++) {
        vector<bool> bList(3,false);
        bingo_check[i] = bList;
    }
    for (int i=0; i<N; i++) {
        int b;
        cin >> b;
        if (hit[b] >0) {
            int tate = card[b].first;
            int yoko = card[b].second;
            bingo_check[tate][yoko] = true;
        }
    }
    bool bingo = false;
    for (int i=0; i<3; i++) {
        if (bingo_check[i][0] && bingo_check[i][1] && bingo_check[i][2]) bingo = true;
        if (bingo_check[0][i] && bingo_check[1][i] && bingo_check[2][i]) bingo = true;
    }
    if (bingo_check[0][0] && bingo_check[1][1] && bingo_check[2][2]) bingo = true;
    if (bingo_check[0][2] && bingo_check[1][1] && bingo_check[2][0]) bingo = true;

    // output
    if (bingo) cout << "Yes" << endl;
    else cout << "No" << endl;
    // cout << fixed << setprecision(10) << middle << endl;

    return 0;
}


Measured memory_bytes: 256