akhauriyash/Code-Regression huggingface dataset:
//author Eterna King
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
#define lowbit(x) ((x) & (-(x)))
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\in.txt", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\out.txt", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%lld\n", x)
#define memset0(arr) memset(arr, 0, sizeof(arr))
#define il inline
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1e4;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
il int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
set<int> st[4];
//0无 1A 2B 3BA
string s[maxn + 5], res1, res2, res;
int ans, n;
int main()
{
	n = read_int();
	for (int i = 1; i <= n; ++i) {
		cin >> s[i];
		if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A')st[3].insert(i);
		else if (s[i][0] == 'B')st[2].insert(i);
		else if (s[i][s[i].size() - 1] == 'A')st[1].insert(i);
		else st[0].insert(i);
	}
	for (auto& p : st[0])res1 += s[p];
	for (auto& p : st[3])res2 += s[p];
	if (st[1].size()) {
		int pos = *st[1].begin();
		st[1].erase(pos);
		res2 = s[pos] + res2;
	}
	if (st[2].size()) {
		int pos = *st[2].begin();
		st[2].erase(pos);
		res2 += s[pos];
	}
	while (st[1].size() && st[2].size()) {
		int pos1 = *st[1].begin(), pos2 = *st[2].begin();
		st[1].erase(pos1), st[2].erase(pos2);
		res2 += (s[pos1] + s[pos2]);
	}
	if (st[1].size())for (auto& p : st[1])res2 += s[p];
	if (st[2].size())for (auto& p : st[2])res2 += s[p];
	res = res1 + res2;
	for (int i = 0; i + 1 < res.size(); ++i)if (res[i] == 'A' && res[i + 1] == 'B')++ans;
	cout << ans << endl;
	//system("pause");
	return 0;
}

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

int main(){
    #ifdef magUNbos
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    #endif // magUNbos
    string s;
    while (cin>>s){
        bool N=false, S=false,W=false,E=false;
        For(i,s.length()){
            if(s[i]=='N')
                N=true;
            if(s[i]=='S')
                S=true;
            if(s[i]=='E')
                E=true;
            if(s[i]=='W')
                W=true;
        }
        if((N && !S )|| (!N && S )|| (!E && W )|| (!W && E ))
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;
    }
}


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

using namespace std;

#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const int mn = 2e5 + 5;
const int mod = 998244353;

int n, m;

struct edge {
	int u, v, directed;

	int to(int x) { return x == u ? v : u; }
} e[mn];

vector<int> g[mn];
vector<int> span_tree;

int f[mn];
int out[mn];

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

void dfs(int x, int fa) {
	for (auto &i:g[x]) {
		if (fa != e[i].to(x)) {
			dfs(e[i].to(x), x);
		}
	}
	for (auto &i:g[x]) {
		if (!e[i].directed) {
			if (out[x] % 2 == 0) {
				if (e[i].v == x) e[i].directed = 1, out[e[i].u]++;
				else e[i].directed = -1, out[e[i].v]++;
			} else {
				if (e[i].u == x) e[i].directed = 1, out[e[i].u]++;
				else e[i].directed = -1, out[e[i].v]++;
			}
		}
	}

}

int main() {
#ifdef LOCAL
	freopen("../1.txt", "r", stdin);
	freopen("../2.txt", "w", stdout);
	size_t bg = clock();
#endif
	scanf("%d%d", &n, &m);
	if (m & 1) {
		puts("-1");
		return 0;
	}
	for (int i = 1; i <= m; i++) {
		scanf("%d%d", &e[i].u, &e[i].v);
	}
	for (int i = 1; i <= n; i++) {
		f[i] = i;
	}

	for (int i = 1; i <= m; i++) {
		if (sf(e[i].u) != sf(e[i].v)) {
			span_tree.pb(i);
			f[sf(e[i].u)] = sf(e[i].v);
		} else {
			e[i].directed = 1;
			out[e[i].u]++;
		}
	}
	for (auto &i:span_tree) {
		g[e[i].u].pb(i);
		g[e[i].v].pb(i);
	}
	//for (int i = 1; i <= n; i++) printf("!%d %d\n", i, out[i]);
	for (int i = 1; i <= n; i++) {
		if (sz(g[i]) > 1) {
			dfs(i, 0);
			break;
		}
	}
	for (int i = 1; i <= m; i++) {
		if (e[i].directed == 1) printf("%d %d\n", e[i].u, e[i].v);
		else printf("%d %d\n", e[i].v, e[i].u);
	}

#ifdef LOCAL
	size_t ed = clock();
	printf("time: %f\n", (double) (ed - bg) / CLOCKS_PER_SEC);
#endif
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  if(S == "Sunny"){
  cout << "Cloudy";
  }else if(S == "Rainy"){
  cout << "Sunny";
  }else if(S == "Cloudy"){
  cout << "Rainy";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = (int)(n-1); i >= 0; i--)
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
    return 0;
}

Measured memory_bytes: 256
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int a,b;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>a>>b;
	cout<<a*b<<endl;
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
using namespace std;
int main(){
	string sd;
	cin>>sd;
	
	string t;
	cin>>t;
	
	size_t n=sd.size();
	size_t m=t.size();
	string s;
	bool isCan;
	for(int i=n-m;i>=0;--i){
		s=sd;
		for(int j=0;j<m;++j){
			isCan = true;
			if(sd[i+j]=='?' or t[j]==sd[i+j]){
			  s[i+j] = t[j];
			}else{
				isCan=false;
				break;
		    }
		}
		if(isCan)
		  break;
	}
	if(isCan){
	for(auto& i : s){
		if(i=='?') i='a';
	}
	cout<< s << endl;
	}else{
		cout<<"UNRESTORABLE"<<endl;
    }
	return 0;
}

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

int main(void){
  long long int n,k,tmp,p;
  scanf("%lld %lld", &n, &k);
  
  p=n/k;
  n=n-(p*k);
  
  tmp=n-k;
  k=labs(tmp);
  
  if(n>=k){
    printf("%lld", k);
  }else{
    printf("%lld", n);
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int H,W,cnt,t[102][102];
int dx[2][6]={  {-1, 0,0,-1,-1,1},{ 1,1,1,0,-1, 0} };
  
int dy[2][6]={  { 0,-1,1,-1, 1,0},{-1,0,1,1, 0,-1}};
void dfs(int y,int x){
  int nx,ny;
  t[y][x]=-1;
  for(int i=0;i<6;i++){
    nx=x+dx[y%2][i];
    ny=y+dy[y%2][i];
    if(nx<0||W+1<nx||ny<0||ny>H+1)continue;
    if(t[ny][nx]==1){
      cnt++;
    }
  }
  for(int i=0;i<6;i++){
    nx=x+dx[y%2][i];
    ny=y+dy[y%2][i];
    if(nx<0||W+1<nx||ny<0||ny>H+1)continue;
    if(t[ny][nx]==0){
      dfs(ny,nx);
    }
  }
}
int main(){
   
    cin>>W>>H;
    
    for(int i=0;i<102;i++){
      for(int j=0;j<102;j++){
    t[i][j]=0;
      }
    }
    for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
    cin>>t[i][j];
      }
    }
    cnt=0;
    dfs(0,0);
    cout<<cnt<<endl;
   
  return 0;
}

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

int main()
{
    int s, prev;
    cin >> s;
    set<int> a{};
    a.insert(s);
    prev = s;
    int count = 1;
    while (1)
    {
        ++count;
        prev = (prev % 2 == 0 ? prev / 2 : 3 * prev + 1);
        if (a.find(prev) == a.end())
        {
            a.insert(prev);
        }
        else
        {
            cout << count << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
      ABC086.AnswerC();
    }
}

class ABC086
{
    public static void AnswerC()
		{
			var N = int.Parse(Console.ReadLine());
			bool result = true;
			var b_point = new Point(0, 0);
			int b_time = 0;
			for(int i = 0; i < N; i++)
			{
				var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
				var to_point = new Point(input[1], input[2]);
				var t = input[0] - b_time;
				if (!Point.CanReach(t, b_point, to_point))
				{
					result = false;
				}
				b_point = to_point;
				b_time = input[0];
			}
			Console.WriteLine(result ? "Yes" : "No");
		}
}

public class Point
{
		public int X { get; set; }
		public int Y { get; set; }

		public Point(int x, int y)
		{
			this.X = x;
			this.Y = y;
		}

		public static bool CanReach(int t,Point b_point,Point target_point)
		{
			int timeToReach = GetTimeToReach(b_point, target_point);
			if (t < timeToReach)
			{
				return false;
			}
			else if(t==timeToReach)
			{
				return true;
			}
			else
			{
				int overtime = (t - timeToReach);
				if (overtime % 2 == 0)
					return true;
				else
					return false;
			}
		}
		public static int GetTimeToReach(Point b_point,Point target_point)
		{
			int variation_x = Math.Abs(target_point.X - b_point.X);
			int variation_y = Math.Abs(target_point.Y - b_point.Y);
			return variation_x + variation_y;
		}
	}

Measured memory_bytes: 15400
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
#include <utility>
#include <numeric>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i=0;(i)<(n);(i)++)
#define repi(i, n) for (int i=0;(i)<=(n);(i)++)
#define repr(i, n) for (int i=n;(i)>=0;(i)--)
#define INF (1<<29)
#define print(x) (cout<<x<<endl)

int main() {
    int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
    int ans_sugar=0;
    int ans_total=100*a;
    double conc_max = 0.0;
    repi(wi, f/(100*a)) {
        repi(wj, f/(100*b)) {
            int water = (wi*a+wj*b)*100;
            if (water==0 or water>f) break;
            repi(si, f/c) {
                repi(sj, f/d) {
                    int sugar = si*c+sj*d;
                    if (water+sugar>f) break;
                    double conc = 100.0*sugar/(sugar+water);
                    if (conc>conc_max and 1.0*water*e/100>=sugar) {
                        conc_max = conc;
                        ans_sugar = sugar;
                        ans_total = sugar+water;
                    }
                }
            }
        }
    }
    printf("%d %d\n", ans_total, ans_sugar);
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	
	for i := 0; i <= x; i++ {
		j := x - i
		legs := 2 * i + 4 * j
		if legs == y {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

Measured memory_bytes: 1768
#include <stdio.h>

int main(){
    char s[100]={};
    scanf("%s",s);
    for(int i=0;i<50;i++){
        if((s[2*i]!='R')&&(s[2*i]!='U')&&(s[2*i]!='D')&&(s[2*i]!=0)){
            printf("No");
            return 0;
        }
        if((s[2*i+1]!='L')&&(s[2*i+1]!='U')&&(s[2*i+1]!='D')&&(s[2*i+1]!=0)){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;

}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
  bool judge = true;
  int a, b, c;
  int counter = 0;
  cin >> a >> b >> c;

  for (int i = a; i <= b; i++) {
    if (c % i == 0) {
      counter++;
    }
  }
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    cin>>k;
    string a,b;
    cin>>a;
    b=a.substr(0,k/2);
    if(b+b==a)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define nln printf("\n")
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll t, n, x, a, b;
    scl(a);
    scl(b);
    ll i = 1, j = 0, k = 0;

    while (i <= 9)
    {
        j = 0;
        while (j <= 9)
        {
            k = 0;
            while (k <= 9)
            {
                ll num = 0;
                num += (i * 10000);
                num += i;
                num += (j * 1000);
                num += (j * 10);
                num += (k * 100);
                mp[num] += 1;
                k++;
            }
            j++;
        }
        i++;
    }
    ll cnt = 0;
    for (auto k : mp)
    {
        if (k.first >= a && k.first <= b)
        {
            cnt++;
        }
    }
    pcl(cnt);
    return 0;
}

Measured memory_bytes: 3808
def main():
    n = int(input())
    s = input()
    l, r = 0, 0
    for c in s:
        if c == '(':
            l += 1
        else:
            if l:
                l -= 1
            else:
                r += 1
    print('(' * r + s + ')' * l)


if __name__ == '__main__':
    main()

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

int main() {
  int h, w, s = 0;
  cin >> h >> w;
  int k = h * w;
  char c;
  for(int i = 0;i < k;i++) {
    cin >> c;
    if(c == '#') s++;
  }
  cout << ((s == h + w - 1) ? "Possible" : "Impossible") << endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

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

	    int a=gi();
	    int b=gi();

        System.out.println(Math.max(a+b, Math.max(a-b, a*b)));
//        if (Math.abs(a-c)<=d || (Math.abs(a-b)<=d && Math.abs(b-c)<=d)) {
//        	System.out.print("Yes");
//        }else {
//        	System.out.print("No");
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
	
	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

        int N, L;
        std::cin >> N >> L;

        vector<int> apple(N);
        std::iota(ALL(apple), L);

        int ans = 0;
        int e       = INF;
        int e_index = -1;
        REP(i, N) {
            ans += apple[i];
            if(abs(apple[i]) < e) {
                e       = abs(apple[i]);
                e_index = i;
            }
        }

        std::cout << ans - apple[e_index] << std::endl;
    }
    catch(const exception& e) {
        std::cout << e.what() << std::endl;
        exit(1);
    }
    return 0;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(n, -1);
    for (int i = 0; i < m; ++i) {
        int s, c;
        cin >> s >> c;
        s--;
        if (a[s] != -1 && a[s] != c) {
            cout << -1 << endl;
            return 0;
        }
        a[s] = c;
    }
    if (a[0] == 0) {
        if (n == 1) {
            cout << 0 << endl;
        } else {
            cout << -1 << endl;
        }
        return 0;
    }
    if (a[0] == -1) a[0] = (n == 1) ? 0 : 1;
    for (int i = 1; i < n; ++i) if (a[i] == -1) a[i] = 0;
    for (int i = 0; i < n; ++i) cout << a[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int db[100100][25];
ll x[100100];

int main(void){
	int n,i,j=0,q,a,b,ans,tmp;
	ll l;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> x[i];
	}
	cin >> l;
	for(i=0; i<n; ++i){
		while(j+1<n && x[j+1]-x[i]<=l){
			++j;
		}
		db[i][0] = j;
	}
	for(j=0; j<20; ++j){
		for(i=0; i<n; ++i){
			db[i][j+1] = db[db[i][j]][j];
		}
	}
	cin >> q;
	for(i=0; i<q; ++i){
		cin >> a >> b; --a; --b;
		if(a>b){
			swap(a,b);
		}
		ans = INF;
		tmp = 0;
		for(j=20; j>=0; --j){
			if(db[a][j]>=b){
				ans = min(ans,tmp+(1<<j));
			}else{
				tmp += (1<<j);
				a = db[a][j];
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 11392
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    
    if op == '?':
        break
    
    if op == '+':
        print(a + b)
    
    if op == '-':
        print(a - b)
        
    if op == '*':
        print(a * b)
        
    if op == '/':
        print(a // b)

Measured memory_bytes: 7644
#include <cstdio>
#include <algorithm>
#include <cstring>
const int N = 1e5 + 10;
typedef long long ll;
int n, a, b, h[N];
ll mid;
bool check() {
	ll co = 0;
	for (int i = 1; i <= n; i++) co += std::max((h[i] - mid*b + (a - b - 1))/(a - b), 0ll);
	return co <= mid;
}
int main() {
//	freopen("input", "r", stdin);
	scanf("%d%d%d", &n, &a, &b);
	ll l = 0, r = 0;
	for (int i = 1; i <= n; i++) scanf("%d", h + i), r += (h[i] + a - 1)/a;
	while (l < r) {
		mid = (l + r) >> 1;
		if (check()) r = mid;
		else l = mid + 1;
	}
	printf("%lld\n", l);
}

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

int main(){
    int X;
    cin>>X;
    vector<bool> expo(X+1);
    
    expo[1] = 1;
    for(int b = 2;b<=X;b++){
        int v = b*b;
        while(v<=X){
            expo[v] = 1;
            v *= b;
        }
    }
    for(int i=X;i>=1;i--) if(expo[i]){
        cout<<i<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
N=int(input())

def ch(t1,t2,x1,x2,y1,y2):
    dt=t2-t1
    dx=abs(x2-x1)
    dy=abs(y2-y1)
    if dt<dx+dy:
        return False
    if dt%2 != (dx+dy)%2:
        return False
    return True


t1=0
t2=0
x1=0
x2=0
y1=0
y2=0

f=1
for i in range(N):
    t2,x2,y2=map(int,input().split())
    if ch(t1,t2,x1,x2,y1,y2)==False:
        f=0
    t1=t2
    x1=x2
    y1=y2
    
if f==1:
    print("Yes")
else:
    print("No")

    




Measured memory_bytes: 46696
N = int(input())
ST = [list(input().split()) for i in range(N)]
X = input()

flag=0;ans=0
for st in ST:
  s=st[0]
  t=int(st[1])
  
  if flag==1:
    ans+=t
  if X==s:
    flag=1
print(ans)
  

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

int main()
{
  char s[99];
  int pld = 1;
  int len = 0;
  int dv = 0;

    scanf("%s",s);
  
  len = strlen(s)-1;
  dv = (len -1)/2;
  for(int i = 0;i < dv;i++)
  {
    if(s[i] != s[len - i] || s[i] != s[((len - 1) /2) -i] || s[i] != s[len-dv+i])
    {      
      pld = 0;
    }
  }
  if(pld == 1)
  {
    printf("Yes");
  }
  else
  {
    printf("No");     
  }
    return 0;
}

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

using namespace std;

int main(){
    string s,t;cin>>s>>t;
    if(s.size()+1==t.size() && t.substr(0,s.size())==s){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
}


Measured memory_bytes: 3580
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;


Node root;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){ //

  if( u == NIL || k == u->key ) {//あればkeyを、なければNILをかえす
    return u;
  }

  //探し続ける
  if(k < u->key) {
    return treeSearch(u->left, k);
  }
  else {
   return treeSearch(u->right, k);
  }
  //
}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  y = NIL;
  x = root;

  while(x != NIL)
    {

      y = x;

      if( z->key < x->key ) {
	x = x->left;
      }
      else {
	x = x->right;
      }

    }

  z->parent = y;

  if(y == NIL) {
    root = z;
  } //if T is empty
  else if( z->key < y->key ) {
    y->left = z;
  }
  else {
    y->right = z;
  }

}

void inorder(Node u){

  if(u == NIL) {
    return;
  }
  else {
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }

}
void preorder(Node u){

  if(u == NIL) {
    return;
  }
  else {
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }

}


int main(){
  int n, i, x;
  char com[20];
  char *ans[10000];
  int cnt=0;
  int flag=0;
  int f_flag=0;
  int O_flag=0;
  int flag2=0;


  /* scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);


    if ( com[0] == 'f'){
      scanf("%d", &x);

      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
      /*    if ( t != NIL ) {
	ans[cnt+O_flag] = "yes"; 
	cnt++; //printf("yes\n"); 
      }
      else {
	ans[cnt+O_flag] = "no"; 
	cnt++; //printf("no\n");
      }

      flag = cnt;


    } 


    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } 


      

    }

    else if ( com[0] == 'p'){
      /* for( cnt=O_flag; cnt < flag+O_flag; cnt++) {

	printf("%s\n", ans[cnt]); 

	}



      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");

      //O_flag = cnt; 
      //cnt = 0;

    } 
   





    else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;*/

scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;




}

Measured memory_bytes: 19364
n,w=map(int,input().split())
sum_val=0
ws=[]
vs=[]
for i in range(n):
    wi,vi=map(int,input().split())
    ws.append(wi)
    vs.append(vi)
    sum_val+=vi
dp=[10**12 for i in range(sum_val+1)]
dp[0]=0
for i in range(n):
    for j in range(sum_val-vs[i],-1,-1):
        dp[j+vs[i]]=min(dp[j+vs[i]],dp[j]+ws[i])
ans=0
for i in range(sum_val+1):
    if dp[i]<=w:
        ans=max(ans,i)
print(ans)


Measured memory_bytes: 45168
#include<cstdio>
#include<iostream>
#include<cstring>
#include<assert.h>
using namespace std;
bool vis[30];
char s[30];
int n;
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	
	if (n<=25)
	{ 
		for (int i=1;i<=n;i++)
			vis[s[i]-'a']=1;
		char c=0;
		while (vis[c]) c++;
	//	if (c+'a'>s[1])
		{
	//		while (1);
			printf("%s",s+1);
			printf("%c",c+'a');
		}
	//	else
	//	{
	//		assert(0);
	//		printf("%c",c+'a');
	//		char nw='a';
	//		for (int i=1;i<=n;i++)
	//		{
	//			if (nw==c+'a') {nw++;i--;continue;}
	//			printf("%c",nw);nw++;
	//		}
	//	}
	}
	else
	{
		int j=n,len=1;//,nw=s[n];
		while (s[j-1]-s[j]>0) j--,len++;
		if (len==26) printf("-1");
		else
		{
			for (int i=1;i<n-len;i++)
				printf("%c",s[i]);
			for (int i=n-len+1;i<=n;i++) vis[s[i]-'a']=1;
			char c=s[n-len]-'a';
			while (!vis[c]) c++; 
			printf("%c",c+'a');
		}
	}
} 

Measured memory_bytes: 256
def we_love_abc(S: str)->int:
    ABC = 'ABC'
    MOD = 1000000007

    dp = [0, 0, 0, 0]
    dp[3] = 1

    for c in reversed(S):
        for j in range(3):
            m1 = 3 if c == '?' else 1
            m2 = 1 if c == '?' or c == ABC[j] else 0
            dp[j] = (m1 * dp[j] + m2 * dp[j+1]) % MOD
        dp[3] = (3 if c == '?' else 1) * dp[3]
        dp[3] %= MOD

    return dp[0] % MOD


if __name__ == "__main__":
    S = input()
    ans = we_love_abc(S)
    print(ans)


Measured memory_bytes: 3188
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static long[] ReadLongArray()
    {
	return ReadLine().Split().Select(x => long.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	long[] a = ReadLongArray();

	long total = a.Sum();
	long sum = 0;

	long min = total;
	for (int i = 0; i < n-1; i++)
	{
	    sum += a[i];
	    long d = Math.Abs(total - 2*sum);
	    min = Math.Min(min, d);
	}

	WriteLine(min);
    }
}

Measured memory_bytes: 39248
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll a,b;
    cin >> a >> b;
    ll h=__gcd(a,b);
    cout << a*b/h << endl;
}


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

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		int count = 0;
		for (int i = a; i <= b; i++){
			if (c % i == 0){
				count += 1;
			}
		}
		System.out.println(builder.append(count));
		

	}

}

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

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
half_max = a_max / 2
tmp = [abs(half_max - v) for v in a]
b = a[tmp.index(min(tmp))]
if b == a_max and 0 in a:
    print("{} 0".format(a_max))
else:
    print("{} {}".format(a_max, b))


Measured memory_bytes: 14428
#pragma GCC optimize("O3")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
#define re return
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all(x)),x.resize(unique(all(x))-x.begin())
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define PI 3.14159265358979323846
#define E 2.71828182845904523536
#define er erase
#define in insert
#define fo(i,n) for((i)=0;(i)<(n);(i)++)
#define ro(i,n) for((i)=n-1;(i)>=0;(i)--)
#define fr(i,j,n) for((i)=(j);(i)<(n);(i)++)
#define rf(i,j,n) for((i)=((n)-1);(i)>=(j);(i)--)
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
    const int N=(int)4e5+100;
    const int inf=(int)1e9+100;
#define filename ""

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen(filename".in","r",stdin);
    //freopen(filename".out","w",stdout);
    //freopen("ans.txt","w",stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    srand(time(0));
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a,b;
    cin>>a>>b;
    if (a*500>=b)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(int i=a;i<=b;i++)

using namespace std;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef set<int> si;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m,x,y;
	cin >> n >> m >> x >> y;
	int arr[n+5], arr2[m+5];
	f(i,0,n-1){
		cin >> arr[i];
	}
	f(i,0,m-1){
		cin >> arr2[i];
	}
	sort(arr,arr+n);
	sort(arr2,arr2+m);
	
	if(arr2[0] - arr[n-1] >= 1){
		int t1 = arr[n-1] + 1;
		int t2 =  arr2[0];
		
		f(i,t1,t2){
			if(i > x && i <= y){
				cout << "No War" << endl;
				return 0;
			}
		}
		cout << "War" << endl;
	}else{
		cout << "War" << endl;
	}
	return 0;
	
}


Measured memory_bytes: 256
function permutation(n,k){
    var ret=[[]];
    var next;
    for(var i=0;i<k;i++){
        next=[];
        ret.forEach(e=>{
            for(var k=1;k<=n;k++){
                if(!e.includes(k)){
                    next.push(e.concat([k]));
                }
            }
        });
        ret=next.concat([]);
    }
    return ret;
}

function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  var X=input[0].split(' ')[0]-0;
  loop1:
  while(true){
    for(var i=2;i**2<=X;i++){
      if(X%i===0){
        X++;
        continue loop1;
      }
    }
    console.log(X);
    return;
  }
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29672
n=int(input())
inp=list(map(int,input().strip().split()))[:n]
min1=99999999
for i in range(max(inp)):
    sum1=0
    l=i+1
    for j in inp:
        sum1+=(j-l)**2
    min1=min(min1,sum1)
print(min1)

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	long long int N, K;
	cin >> N >> K;
	if (K % 2 != 0) {
		long long int sum = (N / K) * (N / K) * (N / K);
		cout << sum;
	}
	else {
		long long int sum = 0;
		sum = (N / K) * (N / K) * (N / K);
		sum = sum + ((N + K / 2) / K) * ((N + K / 2) / K) * ((N + K / 2) / K);
		cout << sum;
	}
}

Measured memory_bytes: 256
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <functional>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

int main() {
  string o, e;
  cin >> o >> e;
  int o_size = (int)(o.length());
  int e_size = (int)(e.length());

  rep(i, e_size) {
    cout << o[i] << e[i];
  }

  if(o_size-e_size == 1) {
    cout << o[o_size-1];
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import deque
n,q=map(int,input().split())
E=[[] for _ in range(n)]
visited=[False]*n
point=[0]*n
for i in range(n-1):
   a,b=map(int,input().split())
   E[a-1].append(b-1)
   E[b-1].append(a-1)
for i in range(q):
   p,x=map(int,input().split())
   point[p-1]+=x

que=deque([0])
while que:
   v=que.popleft()
   visited[v]=True
   for nv in E[v]:
      if visited[nv]==True:
         continue
      point[nv]+=point[v]
      que.append(nv)
print(*point)

Measured memory_bytes: 105236
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 1505; 
using namespace std;

int n, m, cnt[N], sum[N][N]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int main()
{
	n = read <int> (), m = read <int> (), n = (1 << n) - 1, m = (1 << m) - 1; 
	for(int i = 1; i <= n; i++) cnt[i] = cnt[i >> 1] + (i & 1); 
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) sum[i][j] = cnt[i & j] & 1; 
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
			printf("%d", sum[i][j] ^ sum[i - 1][j] ^ sum[i][j - 1] ^ sum[i - 1][j - 1]);
		puts(""); 
	}
	return 0; 
}


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

int main(void)
{
  char s[110];
  scanf("%s",s);
  int i,sl = strlen(s),hug = 0;
  for(i=0;i<sl/2;i++)
    if(s[i]!=s[sl-i-1]){
      s[sl-i-1] = s[i];
      hug++;
    }
  printf("%d\n",hug);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll n;cin>>n;
    vector<ll> a(n);
    For(i,0,n) cin>>a[i];
    sort(ALL(a));
    bool flag=true;
    For(i,0,n-1){
        if(a[i]==a[i+1]) flag=false;
    }
    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;


long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();
  ll N, K; cin>>N>>K;
  ll ansans=N-K+1;
  cout<<ansans<<endl;
  for(int i=2; i<=K; i++){
    ll ans, red, blue;
    red=COM(N-K-1, i);
    red=(red+COM(N-K-1, i-1))%MOD;
    red=(red+COM(N-K-1, i-1))%MOD;
    red=(red+COM(N-K-1, i-2))%MOD;    
    blue=COM(K-1, i-1);
    ans=red*blue%MOD;
    cout<<ans<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int A = 0;
    int B = 0;
    cin >> A >> B;

    for (int i = 0; i < 10000; i++)
    {
        if ((int)(i * 0.08) == A &&
            (int)(i * 0.10) == B)
        {
            cout << i << endl;
            return 0;
        }
    }
        cout << -1;
}

Measured memory_bytes: 256
lines = []
while line = gets
  lines << line.chomp.split
end
a = lines[1].map(&:to_i)
b = lines[2].map(&:to_i)
m = []
for i in 3..(lines.size-1)
  x,y,c = lines[i].map(&:to_i)
  m << a[x-1] + b[y-1] - c
end

if  m.min > a.min + b.min
  puts a.min + b.min
else
  puts m.min
end


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

int main(){
    int n;
    cin >> n;
    vector<pair<int, int>> vec(n);

    for(int i=0;i<n;i++){
        int d;
        cin >> d;
        vec[i].first = d;
        vec[i].second = i;
    }

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

    cout << vec[n/2].first - vec[n/2 - 1].first << endl;
}

Measured memory_bytes: 3992
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b){
  if(b == 0LL) return a;
  return gcd(b, a % b);
}

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

    cout << a * b / gcd(a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

int my_stoi(string s){
	int res = 0;
	
	for(int i = 0; i < s.size(); i++){
		res = s[i] - '0' + res * 10;
	}
	
	return res;
}

signed main(){
	// cin.tie(nullptr);
	// ios::sync_with_stdio(false);
	// cout<<fixed<<setprecision(10);
	
	string s;
	int n, ans = 0;
	
	cin>>s;
	
	n = (int)s.size();
	
	for(int i = 0; i < (1<<(n-1)); i++){
		int res = 0;
		string x = s.substr(0,1);
		
		// cout<<"i = "<<i<<endl;
		
		for(int j = 1; j < n; j++){ 
			// cout<<"j = "<<j<<" "<<x<<endl;
			if(i&(1<<(j-1))) {
				// cout<<"<> "<<x<<endl;
				res += my_stoi(x);
				x.clear();
			}
			x += s[j];
		}
		// cout<<"x = "<<x<<endl;
		
		res += my_stoi(x);
		
		// cout<<"res "<<res<<endl;
		
		ans += res;
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <vector>
#include <array>

int main()
{
    uint32_t N;
    std::cin >> N;

    std::vector<uint32_t> discSizeList(N);
    for (auto& discSize : discSizeList) {
        std::cin >> discSize;
    }

    std::sort(discSizeList.begin(), discSizeList.end());
    discSizeList.erase(std::unique(discSizeList.begin(), discSizeList.end()), discSizeList.end());

    std::cout << discSizeList.size() << std::endl;

    return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 1; i <= a[0]; i ++) {
    bool flag = true;
    for (int j = 0; j < n; j ++) {
      if (a[j] % i != 0) flag = false;
    }
    if (flag) cout << i << endl;
  }
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n;
	cin >> n;
	set<ll> a;
	rep(i,n){
		ll tmp;
		cin >> tmp;
		a.insert(tmp);
	} 

	if(a.size() == n) cout << "YES" << endl;
	else cout << "NO" << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 9728
points = []
n = 0
sum = 0
cnt = 0
while line = gets
	points[n] = line.to_i
	n += 1
end
points.shift()
points.sort!

points.each{|var|
	sum += var
}
#p(points)
while true 
	if sum % 10 != 0
		break
	elsif cnt == points.length
		sum = 0
		break
	elsif points[cnt] % 10 != 0
		sum -= points[cnt]
		cnt += 1
	else
		cnt += 1
	end
end

p(sum)


Measured memory_bytes: 1788
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.ArrayList;

public class Main {
	public static class UnionFind{
		int[] par;
		UnionFind(int n){
			par=new int[n];
			for(int i=0;i<n;i++)par[i]=i;
		}
		public int find(int x){
			if(par[x]==x)return x;
			return par[x]=find(par[x]);
		}
		public boolean same(int x,int y){
			return find(x)==find(y);
		}
		public boolean unite(int x,int y){
			if(find(x)==find(y)) return false;
			par[find(x)]=find(y);
			return true;
		}
	}

	public static void main(String[] args) {
		FS r = new FS();
		int N = r.nextInt();
		int M = r.nextInt();
		UnionFind uf = new UnionFind(N);
		ArrayList<ArrayList<Integer>> lang = new ArrayList<ArrayList<Integer>>();
		for(int i=0; i<M; i++) {
			lang.add(new ArrayList<Integer>());
		}
		for(int i=0; i<N; i++) {
			int k = r.nextInt();
			for(int j=0; j<k; j++) {
				lang.get(r.nextInt()-1).add(i);
			}
		}
		int counter = 0;
		for(int i=0; i<M; i++) {
			ArrayList<Integer> lst = lang.get(i);
			for(int j=0; j<lst.size()-1; j++) {
				if(uf.unite(lst.get(j), lst.get(j+1))) counter++;
			}
		}
		if(counter+1==N) System.out.println("YES");
		else System.out.println("NO");
	}
	
	public static void solver() {
		// write logic
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

Measured memory_bytes: 20284
inf = 10 ** 9
n,a,b = gets.split.map(&:to_i)
diff = a - b

hp = Array.new(n)
n.times {|i| hp[i] = gets.to_i }

puts (0..inf).bsearch { |t|
  count = 0
  hp.each do |h|
    re = h - b * t
    next if re < 1
    div, mod = re.divmod(diff)
    count += div
    count += 1 if mod > 0
  end
  count <= t
}

Measured memory_bytes: 2812
while True:
    n,m = map(int,input().split())
    if n == 0:
        exit()
    t = []
    h = []
    ans = []
    for i in range(n):
        t.append(int(input()))
    for i in range(m):
        h.append(int(input()))
    for i in range(n):
        for j in range(m):
            if (sum(t) - t[i] + h[j]) == (sum(h) - h[j] + t[i]):
                ans.append([t[i] + h[j], t[i], h[j]])
    ans = sorted(ans)
    if len(ans) != 0:
        print(str(ans[0][1]) + " " + str(ans[0][2]))
    else:
        print(-1)


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
std::string S;

int B[200100], W[200100];

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

    std::cin >> N >> S;

    if(S[0] == '#'){
        B[0] = 1;
    }

    for(int i=1;i<N;++i){
        B[i] = B[i-1] + (S[i] == '#');
    }

    if(S[N-1] == '.'){
        W[N-1] = 1;
    }

    for(int i=N-2;i>=0;--i){
        W[i] = W[i+1] + (S[i] == '.');
    }

    int mn = W[0];

    for(int i=0;i<N;++i){
        mn = std::min(mn, B[i] + W[i+1]);
    }

    std::cout << mn << std::endl;
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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

ll x[55];
ll dp[55][55][10101];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,X;
    cin>>N>>A;
    X=A;
    REP(i,N){
        cin>>x[i];
        chmax(X,x[i]);
    }

    dp[0][0][0] = 1;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++){
            for(int k=0;k<=N*X;k++){
                if(k<x[i-1]) dp[i][j][k] = dp[i-1][j][k];
                else if(j>0)dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]];
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=N;i++) ans += dp[N][i][i*A];
    cout<<ans<<endl;
}

Measured memory_bytes: 217344
N = str(input())
v = [N[i: i+1] for i in range(0, len(N), 1)]
v.sort()
if(v[0]==v[1] and v[2]==v[3]):
    if(v[1]!=v[2]):
        print("Yes")
    else:
        print("No")
else:
    print("No")


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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define EPS (1e-7)
#define INF ((ll)1e9+7)
#define PI (acos(-1))
#define c(a) cout<<a<<"\n";
using namespace std;

int main() {
	speed;
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x3, y3, x4, y4;
	int dx = x2 - x1;
	int dy = y2 - y1;
	x3 = x2 - dy;
	y3 = y2 + dx;
	x4 = x1 - dy;
	y4 = y1 + dx;
	cout << x3 << " " << y3 << " " << x4 << " " << y4;
	ed;
	return 0; 
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

struct data_t {
    int w, v;
};

int min(int X, int Y) {
    return X < Y ? X : Y;
}

int main() {
    int N, w; cin >> N >> w; // N <= 100, w <= 1e9
    data_t I[N + 1];
    for (int i = 1; i <= N; ++i) {
        cin >> I[i].w; // w <= 1e9
        cin >> I[i].v; // v <= 1000
    }

    long W[N + 1][100000 + 1];

    for (int v = 0; v <= 100000; ++v) {
        W[0][v] = 100000000001; // 1e9 * 100 + 1
    }

    for (int i = 1; i <= N; ++i) {
        for (int v = 0; v <= 100000; ++v) {
            if (I[i].v >= v) {
                W[i][v] = min(I[i].w, W[i - 1][v]);
            } else {
                W[i][v] = min(W[i - 1][v], W[i - 1][v - I[i].v] + I[i].w);
            }
        }
    }

    // DEBUG
    // for (int i = 1; i <= N; ++i) {
    //     for (int v = 29; v <= 51; ++v) {
    //         if (v == 29) {
    //             cout << W[i][v];
    //         } else {
    //             cout << " " << W[i][v];
    //         }
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        for (int v = 0; v <= 100000; ++v) {
            if (W[i][v] > w) break;
            ans = max(ans, v);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 79104
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int A[]=new int [N];
		int a=0;
		int b=0;
		int c=0;
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int k=i+1;k<N;k++) {
				if(A[i]<A[k]) {
					c=A[k];
					A[k]=A[i];
					A[i]=c;
				}
			}
		}
		for(int i=0;i<N;i++) {
			a=a+A[i];
			i=i+1;
			if(i<N) {
				b=b+A[i];
			}
		}
		System.out.println(a-b);
	}
}

Measured memory_bytes: 23124