akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;

int sosuu(int n);

int main(){
    double x[3]={0};
    double y[3]={0};
    int i=0;
    scanf("%d",&i);
    while(scanf("%lf",&x[0])!=EOF){
        scanf("%lf",&y[0]);
        scanf("%lf",&x[1]);
        scanf("%lf",&y[1]);
        scanf("%lf",&x[2]);
        scanf("%lf",&y[2]);
        
        double a1= 2*(x[1]-x[0]);
        double b1= 2*(y[1]-y[0]);
        double c1= x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
        
        double a2= 2*(x[2]-x[0]);
        double b2= 2*(y[2]-y[0]);
        double c2= x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];
        
        double xa = (b1*c2-b2*c1)/(a1*b2-a2*b1);
        double ya = (c1*a2-c2*a1)/(a1*b2-a2*b1);
        
        double r =sqrt((xa-x[0])*(xa-x[0])+(ya-y[0])*(ya-y[0]));
        
        printf("%.3lf %.3lf %.3lf\n",xa,ya,r);
        
    }
    
}

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

#define ALL(v) v.begin(), v.end()
typedef long long ll;



using namespace std;
int main() {
	string s;
	cin >> s;
	vector<int> RLarray;
	
	int Rcount = 0;
	int Lcount = 0;
	for (int i = 0; i < s.length(); i++)
	{

		if (s[i] == 'R') {
			if (Lcount != 0) RLarray.push_back(Lcount);
			Rcount++;
			Lcount = 0;
		}
		else {
			if (Rcount != 0) RLarray.push_back(Rcount);
			Lcount++;
			Rcount = 0;
		}
	}
	RLarray.push_back(Lcount);

	for (int i = 0; i < RLarray.size() - 1; i += 2)
	{
		//0を出力
		//R

		int R = RLarray[i];
		int L = RLarray[i + 1];

		for (int i = 0; i < R - 1; i++)
		{
			cout << "0 ";
		}
		
		


		int hanbun = (R + L) / 2;
		//偶数
		if ((R + L) % 2 == 0) {
			cout << hanbun;
			cout << " ";
			cout << hanbun;
			cout << " ";
		}
		else {

			
			//奇数のほうが1多くもらえる
			if (R % 2 == 1) {
				//R
				cout << hanbun + 1;
				cout << " ";
				//L
				cout << hanbun;
				cout << " ";
			}
			else {
				//R
				cout << hanbun;
				cout << " ";
				//L
				cout << hanbun + 1;
				cout << " ";
			}
		}


		
		//０を出力
		//L
		for (int i = 0; i < L - 1; i++)
		{
			cout << "0 ";
		}
	}




}

Measured memory_bytes: 1144
n = int(input())
a = [0]
a += list(map(int, input().split()))
a.append(0)
d = []
for i in range(n + 1):
  d.append(abs(a[i] - a[i + 1]))
s = sum(d)
for i in range(n):
  print(s - d[i] - d[i + 1] + abs(a[i] - a[i + 2]))

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

typedef long long ll;

ll a, b, x;

int main(){
    scanf("%lld%lld%lld", &a, &b, &x);
    ll cnt=0;
    if(a%x==0) cnt++;
    cnt += b/x - a/x; 
    printf("%lld", cnt);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,i,b,count,s=0,n;
    scanf("%d",&a);
    if(a==1)
        printf("%d\n",a);
    else{
    for(i=1;i<=a;i++)
    {
        if(i%2==0){
                b=i;
        count=1;
        while(b!=0)
        {
            b=b/2;
            count++;
        }
        if(count>s){
            s=count;
            n=i;
        }
        }
    }
    printf("%d\n",n);
    }
    return 0;
}

Measured memory_bytes: 128
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
#include <algorithm>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <thread>
#include <math.h>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <set>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for(int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

void Solve(){
	int n,x,t;	cin >> n >> x >> t;
	int ans = 0, now = 0;	
	while(now < n){
		now += x;
		ans += t;
	}
	cout << ans << endl;
}

int main(){
	ios::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
	int t = 1;
	//int t;	cin >> t;
	while(t--) Solve();
	return 0;
}


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

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

int main(){
  string s,t;
  int a,b;
  string u;
  cin >> s >> t >> a >> b >> u;
  if(s==u)cout << a-1 << ' ' << b << endl;
  else cout << a << ' ' << b-1 << endl;
}


Measured memory_bytes: 256
def find(x):
    if parent[x] == x:
        return x
    else:
        return find(parent[x])

def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x != y:
        if rank[x] < rank[y]:
            parent[x] = y
            size[y] += size[x]
        else:
            parent[y] = x
            size[x] += size[y]
            
            if rank[x] == rank[y]:
                rank[x] += 1

n,m = map(int,input().split())
lst = [tuple(map(int,input().split())) for _ in range(m)]

parent = [0] * n
for i in range(n):
    parent[i] = i
rank = [1] * n
size = [1] * n

lst = lst[::-1]
for i in range(m):
    lst[i] = (lst[i][0]-1,lst[i][1]-1)

res = []
for i in range(m):
    par1 = find(lst[i][0])
    par2 = find(lst[i][1])
    if par1 == par2:
        res.append(0)
    else:
        res.append(size[par1] * size[par2])
        unite(par1,par2)

ans = 0
for i in range(m):
    ans += res[m-1-i]
    print(ans)

Measured memory_bytes: 24060
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	list := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&list[i])
	}

	//sort.Sort(sort.IntSlice(list))

	min := 10000 * n
	for i := 1; i <= 100; i++ {
		total := 0
		for j := 0; j < n; j++ {
			total += (list[j] - i) * (list[j] - i)
		}
		if total <= min {
			min = total
		}
	}
	fmt.Println(min)

}


Measured memory_bytes: 512
import java.util.Scanner;

/**
 * 【問題概要】 500 円玉を AA 枚、100 円玉を BB 枚、50 円玉を CC 枚持っています。これらの硬貨の中から何枚かを選び、合計金額をちょうど
 * XX 円にする方法は何通りあるでしょうか？
 *
 * @author tsuch
 *
 */
public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		Main instance = new Main();
		instance.solve();
	}

	private void solve() {
		try {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int x = sc.nextInt();

			int count = 0;

			for (int i = 0; i < x / 500 + 1 && i <= a; i++) {
				for (int j = 0; j < x / 100 + 1 && j <= b; j++) {
					for (int k = 0; k < x / 50 + 1 && k <= c; k++) {
						if (x == 500 * i + 100 * j + 50 * k) {
							count++;
						}
					}
				}
			}
			System.out.println(count);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int dp[100000],a[100000],n,x=100000,y=100000;
int main(){
	cin>>n;
	for (int i = 0; i < n; ++i)
		cin>>a[i];
	for (int i = 1; i < n; ++i){
		if(i-1>=0)x=abs(a[i]-a[i-1])+dp[i-1];
		if(i-2>=0)y=abs(a[i]-a[i-2])+dp[i-2];
		dp[i]=min(x,y);
	}
	cout<<dp[n-1];
	
}

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

// # DEFINES # //
#define ll long long
#define M (ll)1e9+7
#define EPS 1e-9

using namespace std;

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


    int a, b, t;

    cin >> a >> b >> t;

    cout << t/a*b << endl;



    return 0;
}

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

long long a[209];
vector<long long> v;

int bc(long long n)
{
	int s = 0;
	while (n) {
		s++;
		n /= 2;
	}
	return s;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int tc; cin >> tc;
	for (int ti = 0; ti < tc; ti++) {
		v.clear();
		int n; cin >> n;
		for (int i = 0; i < n; i++)
			cin >> a[i];
		string s; cin >> s;
		bool f = true;
		for (int i = n - 1; i >= 0; i--) {
			long long p = a[i];
			for (int j = 0; j < v.size(); j++)
				if (bc(v[j]) == bc(p))
					p = (p ^ v[j]);
			if (!p) continue;
			else {
				if (s[i] == '1') {
					f = false;
					break;
				}
				for (int j = 0; j < v.size(); j++)
					if (bc(v[j]) == bc(a[i]))
						a[i] = (a[i] ^ v[j]);
				v.push_back(a[i]);
				sort(v.begin(), v.end()); reverse(v.begin(), v.end());
			}
		}
		if (f) cout << 0 << '\n';
		else cout << 1 << '\n';
	}
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

ll gcd(ll x, ll y) {
    while (x > 0) {
        ll z = y % x;
        y = x;
        x = z;
    }
    return y;
}

ll K;

ll solve() {
    ll ret = 0;
    FOR (a, 1, K+1) FOR (b, 1, K+1) FOR (c, 1, K+1) {
        ret += gcd(a, gcd(b, c));
    }
    return ret;
}

int main() {
    cin >> K;
    cout << solve() << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <ctype.h>
int main(void){
	char ch;
	int alpha[26] = {0};

	while(scanf("%c",&ch)!=EOF){
		if(isalpha(ch)){
			if(isupper(ch)){
				ch = tolower(ch);
			}
			++alpha[ch-'a'];
		}
	}
	int i;
	for(i=0;i<26;i++){
		printf("%c : %d\n",'a'+i,alpha[i]);
	}
	return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 5;
int a[NMAX], sol, n, m, s;

int main() {
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        a[x]++;
        a[y + 1]--;
    }
    for(int i = 1; i <= n; i++) {
        s += a[i];
        if(s == m) {
            sol++;
        }
    }
    cout << sol;
    return 0;
}


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

X = list(map(int, input().split()))

pos_start_index = 0

if X[0] > 0:
  pos_start_index = 0
elif X[N-1] < 0:
  pos_start_index = N

for n in range(N-1):
  if X[n] == 0:
    pos_start_index = n
    break
  elif X[n] < 0 and X[n+1] > 0:
    pos_start_index = n+1
    break


neg_sum_list = []

for j, idx in enumerate(range(pos_start_index-1, -1, -1)):
  neg_sum_list.append(-X[idx])

pos_sum_list = []

for j, idx in enumerate(range(pos_start_index, N)):
  pos_sum_list.append(X[idx])


res = []

for j, neg_sum in enumerate(neg_sum_list):
  neg_count = j+1
  pos_count = K - neg_count

  if neg_count == K:
    res.append(neg_sum)
    break

  if pos_count <= len(pos_sum_list):
    pos_sum = pos_sum_list[pos_count-1]
    res.append(2*neg_sum + pos_sum)

for j, pos_sum in enumerate(pos_sum_list):
  pos_count = j+1

  neg_count = K - pos_count

  if pos_count == K:
    res.append(pos_sum)
    break

  if neg_count <= len(neg_sum_list):
    neg_sum = neg_sum_list[neg_count-1]
    res.append(2*pos_sum + neg_sum)

print(min(res))


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

int main() {
  int N,ans = 0;
  cin >> N;
  vector<int> a(N);
  for(int i = 0;i < N;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i = 0;i < N;i++){
    if(i % 2) ans -= a.at(i);
    else ans += a.at(i);
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

ll modpow(ll a, ll t) {
    ll ret = 1LL;
    while(t){
        if(t & 1LL){
            ret *= a;
            ret %= MOD;
        }
        a *= a;
        a %= MOD;
        t >>= 1;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> c(n);
    for(int i=0;i<n;++i) {
        cin >> c[i];
    }
    sort(c.rbegin(), c.rend());

    ll ans = 0LL;
    for(int i=0;i<n;++i) {
        ans += c[i] * ll(i+2) % MOD;
        ans %= MOD;
    }
    ans *= modpow(2LL, 2*n-2);
    ans %= MOD;

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

#define int long long int

constexpr int INF = std::numeric_limits<int>::max();

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

    int N, K; cin >> N >> K;
    vector<int> h(N);
    for (int &x : h) {
        cin >> x;
    }

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

    int ans = INF;
    for (int i = 0; i < h.size() - K + 1; i++) {
        ans = min(ans, h[i + K - 1] - h[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

ll ma=1e9+7;


int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
string a[n];
for(int i=0;i<n;i++)
    cin>>a[i];
ll dp[n+1][m+1];
memset(dp,0,sizeof(dp));
for(int i=n-1;i>=0;i--){
    for(int j=m-1;j>=0;j--){
        if(i==n-1 && j==m-1)
            dp[i][j]=1;

    else{
        if(a[i][j]=='.'){
            dp[i][j]=(dp[i+1][j]+dp[i][j+1])%ma;
        }
    }


}
}
cout<<dp[0][0]<<endl;






}


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

int main()
{
    int n,i;
    cin >> n;
    long long m = 0,a = 0,r = 0,c = 0,h = 0;
    string temp;
    for(i = 0;i < n;++i){
        cin >> temp;
        if(temp.at(0) == 'M'){++m;}
        if(temp.at(0) == 'A'){++a;}
        if(temp.at(0) == 'R'){++r;}
        if(temp.at(0) == 'C'){++c;}
        if(temp.at(0) == 'H'){++h;}
    }
    long long ans = m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[]
for i in range(n):
    a=input()
    s.append(a)


p=[]
for i in range(n):
    l=[0 for i in range(26)]
    for j in s[i]:
        if j=="a":
            l[0]+=1
        if j=="b":
            l[1]+=1
        if j=="c":
            l[2]+=1
        if j=="d":
            l[3]+=1
        if j=="e":
            l[4]+=1
        if j=="f":
            l[5]+=1
        if j=="g":
            l[6]+=1
        if j=="h":
            l[7]+=1
        if j=="i":
            l[8]+=1
        if j=="j":
            l[9]+=1
        if j=="k":
            l[10]+=1
        if j=="l":
            l[11]+=1
        if j=="m":
            l[12]+=1
        if j=="n":
            l[13]+=1
        if j=="o":
            l[14]+=1
        if j=="p":
            l[15]+=1
        if j=="q":
            l[16]+=1
        if j=="r":
            l[17]+=1
        if j=="s":
            l[18]+=1
        if j=="t":
            l[19]+=1
        if j=="u":
            l[20]+=1
        if j=="v":
            l[21]+=1
        if j=="w":
            l[22]+=1
        if j=="x":
            l[23]+=1
        if j=="y":
            l[24]+=1
        if j=="z":
            l[25]+=1
    p.append(l)

l=[]

for i in range(26):
    m=1000000000
    for j in range(n):
        m=min(m,p[j][i])
    l.append(m)
ans=""
for i in range(26):
    if i==0 and l[i]>0:
        ans+="a"*l[i]
    if i==1 and l[i]>0:
        ans+="b"*l[i]
    if i==2 and l[i]>0:
        ans+="c"*l[i]
    if i==3 and l[i]>0:
        ans+="d"*l[i]
    if i==4 and l[i]>0:
        ans+="e"*l[i]
    if i==5 and l[i]>0:
        ans+="f"*l[i]
    if i==6 and l[i]>0:
        ans+="g"*l[i]
    if i==7 and l[i]>0:
        ans+="h"*l[i]
    if i==8 and l[i]>0:
        ans+="i"*l[i]
    if i==9 and l[i]>0:
        ans+="j"*l[i]
    if i==10 and l[i]>0:
        ans+="k"*l[i]
    if i==11 and l[i]>0:
        ans+="l"*l[i]
    if i==12 and l[i]>0:
        ans+="m"*l[i]
    if i==13 and l[i]>0:
        ans+="n"*l[i]
    if i==14 and l[i]>0:
        ans+="o"*l[i]
    if i==15 and l[i]>0:
        ans+="p"*l[i]
    if i==16 and l[i]>0:
        ans+="q"*l[i]
    if i==17 and l[i]>0:
        ans+="r"*l[i]
    if i==18 and l[i]>0:
        ans+="s"*l[i]
    if i==19 and l[i]>0:
        ans+="t"*l[i]
    if i==20 and l[i]>0:
        ans+="u"*l[i]
    if i==21 and l[i]>0:
        ans+="v"*l[i]
    if i==22 and l[i]>0:
        ans+="w"*l[i]
    if i==23 and l[i]>0:
        ans+="x"*l[i]
    if i==24 and l[i]>0:
        ans+="y"*l[i]
    if i==25 and l[i]>0:
        ans+="z"*l[i]

print(ans)






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

int main() {
    int h, w;
    cin >> h >> w;

    string s[h];
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                continue;
            }

            int ans = 0;
            for (int ii = i - 1; ii < i + 2; ii++) {
                if (ii < 0) {
                    continue;
                }
                if (ii >= h) {
                    break;
                }
                for (int jj = j - 1; jj < j + 2; jj++) {
                    if (jj < 0) {
                        continue;
                    }
                    if (jj >= w) {
                        break;
                    }

                    if (s[ii][jj] == '#') {
                        ans++;
                    }
                }
            }

            s[i][j] = '0' + ans;
        }
    }

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

    return 0;
}


Measured memory_bytes: 256
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    
    
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)
    else:
        break
        




Measured memory_bytes: 5592
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws NumberFormatException {
		Scanner scan = new Scanner(System.in);
		while(true){
			BigDecimal x = scan.nextBigDecimal();
			if(x.equals(BigDecimal.ZERO)){
				break;
			}
			int sum = 0;
			for(; !x.equals(BigDecimal.ZERO); x = x.divide(BigDecimal.TEN, 0, BigDecimal.ROUND_DOWN)){
				BigDecimal amari = x.divide(BigDecimal.TEN, 0, BigDecimal.ROUND_DOWN);
				amari = amari.multiply(BigDecimal.TEN);
				sum += x.subtract(amari).intValue();
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 26136
#include<stdio.h>
int main()
{
int a,i,j;
long int b;
  scanf("%d",&a);
  b=0;
int c[a];
for(i=0;i<a;++i)
   {scanf("%d",&c[i]);
   }
for(i=1;i<a;++i)  
   {
    for(j=0;j<i;++j)
    {b=b+c[i]*c[j];}
   }
  printf("%ld",b);
  
  
return 0;
}

Measured memory_bytes: 128
l = list(input())
# print(l)
for i in range(1 << len(l) - 1):
    output = ['']
    for j in range(len(l) - 1):
        if ((i >> j) & 1) == 1:
            output.append('+')
        else:
            output.append('-')
    # print(output)
    s = ''.join([b + a for a, b in zip(l, output)])
    # print(s)
    # print(eval(s))
    if eval(s) == 7:
        print(s+'=7')
        break


Measured memory_bytes: 3060
n = gets.to_i
xys = []

n.times do
  xys << gets.split("\s").map(&:to_i)
end
sum = 0
count = 0

(0..n-1).to_a.permutation do |prm|
  post = nil
  prm.each do |i|
    unless post
      post = xys[i]
      next
    end
    sum += Math.sqrt((post[0] - xys[i][0])**2 + (post[1] - xys[i][1])**2)
    post = xys[i]
  end
  count += 1
end
p sum / count.to_f

Measured memory_bytes: 2172
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
ll p=1e9 + 7;
ll solve(){
  int d;
  string k;
  cin>>k>>d;
  ll dp[k.size()+1][d];
  ll powerof10[k.size()+1];
  powerof10[0]=1%d;
  for(int i=1;i<=k.size();i++){
      powerof10[i]=powerof10[i-1]*10;
      powerof10[i]%=d;
  }
  for(int i=0;i<=k.size();i++){
      for(int j=0;j<d;j++){
          dp[i][j]=0;
      }
  }
  dp[0][0]=1;
  ll maximal=0;
  for(int i=0;i<k.size();i++){
    if(i!=0){
        for(int j=0;j<d;j++){
            for(int k=0;k<10;k++){
                dp[i+1][(j+k)%d]+=dp[i][j];
            }
        }
    }
    for(int j=0;j<k[i]-'0';j++){
        dp[i+1][(maximal+j)%d]++;
    }
    maximal+=(k[i]-'0');
    maximal%=d;
    for(int j=0;j<d;j++){
        dp[i+1][j]%=p;
    }
  }
  if(maximal%d){
      dp[k.size()][0]--;
  }
  return (dp[k.size()][0]+p)%p;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<solve();
}

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

int main() {
    int s;
    cin >> s;
    int m = 1000010;
    for (int i = 1; i < m; i++) {
        if (s==1||s==2||s==4) {
            cout << i+3 << endl;
            return 0;
        } else if (s % 2 == 1) {
            s = 3*s + 1;
        } else if (s % 2 == 0) {
            s /= 2;
        }
    }
}

Measured memory_bytes: 256
s = input()
n = len(s)
MOD = 10**9 + 7
dp = [ [0]*13 for _ in range(n+1) ]
dp[0][0] = 1
for i in range(n):
    if s[i] == '?':
        c = -1
    else:
        c = int(s[i])

    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki*10 + j) % 13] += dp[i][ki]
    for j in range(13):
        dp[i+1][j] %= MOD

print(dp[n][5])

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

using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define debug(a) cout << #a << ": " << a << endl;

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;

  vector<int> acCnt(N + 1);
  rep(i, N) {
    int isAC = (S.substr(i, 2) == "AC" ? 1 : 0);
    acCnt[i + 1] = acCnt[i] + isAC;
  }

  rep(i, Q) {
    int l, r;
    cin >> l >> r;
    cout << acCnt[r - 1] - acCnt[l - 1] << endl;
  }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define sz(v) (v).size()
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define inf 10000000
using namespace std;
template <typename T> T Max(T x,T y){return x>y?x:y;}
template <typename T> T Min(T x,T y){return x<y?x:y;}
template <typename T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <typename T> void chmin(T &x,T y){x=x<y?x:y;return;}

const int maxn=300005;
int h,w,m,r,c,maxrow,maxcol,row[maxn],col[maxn],cnt[maxn];
vector<int> rows,cols,v[maxn];

int main()
{
	scanf("%d%d%d",&h,&w,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&r,&c);
		row[r]++,col[c]++;
		v[r].pb(c);
	}
	
	for(int i=1;i<=h;i++)
		chmax(maxrow,row[i]);
	for(int i=1;i<=w;i++)
		chmax(maxcol,col[i]);
	for(int i=1;i<=h;i++)
		if(row[i]==maxrow)
			rows.pb(i);
	for(int i=1;i<=w;i++)
		if(col[i]==maxcol)
			cols.pb(i);
	
	for(int i=0;i<sz(rows);i++)
	{
		r=rows[i];
		for(int j=0;j<v[r].size();j++)
		{
			c=v[r][j];
			cnt[c]++;
		}
	}
	for(int i=0;i<sz(cols);i++)
	{
		c=cols[i];
		if(cnt[c]<sz(rows))
		{
			printf("%d\n",maxrow+maxcol);
			return 0;
		}
	}
	printf("%d\n",maxrow+maxcol-1);
	return 0;
}

Measured memory_bytes: 26136
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  string a,b,c;
  cin >> a;
  int j=0;
  for(int i=0;i<4; i++){
    if(a[i]=='2') j++;
  }
  cout << j <<endl;
   return 0;
}


Measured memory_bytes: 256
from math import ceil
n = int(input())
lst = [list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
    ans = lst[i][0]+lst[i][1]
    for j in range(i+1, n-1):
        k = max(0, ceil((ans-lst[j][1])/lst[j][2]))
        ans = lst[j][1]+k*lst[j][2]+lst[j][0]
    print(ans)
print(0)

Measured memory_bytes: 43484
from collections import Counter


class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


N, K, L = map(int, input().split())
uf1 = UnionFind(N)
uf2 = UnionFind(N)
for _ in range(K):
    p, q = map(int, input().split())
    uf1.union(p - 1, q - 1)

for _ in range(L):
    r, s = map(int, input().split())
    uf2.union(r - 1, s - 1)

path = [None] * N
for i in range(N):
    path[i] = (uf1.find(i), uf2.find(i))

cnt = Counter(path)
for i in range(N - 1):
    print(cnt[path[i]], end=' ')
print(cnt[path[N - 1]])


Measured memory_bytes: 44392
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans = ''
# s to t
ans += 'U' * dy
ans += 'R' * dx
# t to s
ans += 'D' * dy
ans += 'L' * (dx+1)
# s tp t part2
ans += 'U' * (dy+1)
ans += 'R' * (dx+1)
ans += 'D'
# t to s part2
ans += 'R' 
ans += 'D' * (dy+1)
ans += 'L' * (dx+1)
ans += 'U'

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

//char arr[107][107];
int main(){
	Lancer();
	ll n, a,res=0,mx=-100000;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a;
		mx = max(mx, a);
		res += a;
	}
	res -= (mx/2);
	cout << res;
	cout << endl;
	return 0;
}


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


def solve(A: int, B: int, C: int, K: int):
    if A >= K:
        print(K)
        exit()
    sum = A
    K -= A
    K -= B
    print(sum + max(K,0)*-1)
    return


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

if __name__ == '__main__':
    main()


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

int main() {

  vector<int> Bingo(9);

  for (int i = 0; i < 9; i++) {
    cin >> Bingo.at(i);
  }  

  int N;
  cin >> N;

  vector<int> Number(N);

  for (int i = 0; i < N; i++) {
    cin >> Number.at(i);
  }

  for (int i = 0; i < 9; i++) {
    for (int f = 0; f < N; f++) {
      if (Bingo.at(i) == Number.at(f)) {
        Bingo.at(i) = 000;
      }
    }
  }

  int Count = 0;
  
  if (Bingo.at(0) == Bingo.at(4) && Bingo.at(4) == Bingo.at(8)) {Count++;}
  if (Bingo.at(2) == Bingo.at(4) && Bingo.at(4) == Bingo.at(6)) {Count++;}
  if (Bingo.at(0) == Bingo.at(3) && Bingo.at(3) == Bingo.at(6)) {Count++;}
  if (Bingo.at(1) == Bingo.at(4) && Bingo.at(4) == Bingo.at(7)) {Count++;}
  if (Bingo.at(2) == Bingo.at(5) && Bingo.at(5) == Bingo.at(8)) {Count++;}
  if (Bingo.at(0) == Bingo.at(1) && Bingo.at(1) == Bingo.at(2)) {Count++;}
  if (Bingo.at(3) == Bingo.at(4) && Bingo.at(4) == Bingo.at(5)) {Count++;}
  if (Bingo.at(6) == Bingo.at(7) && Bingo.at(7) == Bingo.at(8)) {Count++;}

  if (Count > 0) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 4001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

// MOD確認

Graph G(100010);

ll dir[100010];
ll d[100010];
bool done[100010];
priority_queue<pair<ll,ll>> Q;

void dijkstra(){
    rep(i,100010) d[i] = INF;
    rep(i,100010) done[i] = 0;
    rep(i,100010) dir[i] = -1;
    d[0] = 0;
    Q.emplace(0,0);
    while(Q.size()){
        ll x,cost;
        cost = Q.top().first;
        x = Q.top().second;
        Q.pop();
        done[x] = 1;
        ll n = G[x].size();
        rep(i,n){
            ll y = G[x][i];
            if(done[y]) continue;
            if(d[y] > 1 - cost){
                dir[y] = x;
                d[y] = 1 - cost;
                Q.emplace(cost-1,y);
            }
        }
    }
}

int main(){
    ll N,M;
    cin >> N >> M;
    rep(i,M){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dijkstra();
    FOR(i,1,N){
        if(dir[i] == -1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    FOR(i,1,N){
        cout << dir[i] + 1 << endl;
    }
} 


Measured memory_bytes: 14980
class Dot
  attr_accessor :x, :y, :dir
  def initialize(x, y, direction = nil)
    @x = x.to_i
    @y = y.to_i
    @dir = direction
  end
end

class Way
  attr_accessor :x, :dx
  def initialize(x, dx)
    @x = x
    @dx = dx
  end
end

N = gets.chop.to_i
dots = []
N.times do 
  x, y, dir = gets.chop.split
  dots << Dot.new(x, y, dir)
end

rights = dots.select { |d| d.dir == "R"}
lefts = dots.select { |d| d.dir == "L"}
ups = dots.select { |d| d.dir == "U"}
downs = dots.select { |d| d.dir == "D"}

x_way = []
unless rights.empty?
  if rights.size == 1
    x_way << Way.new(rights[0].x, 1)
  else
    x_way << Way.new(rights.max_by(&:x).x, 1)
    x_way << Way.new(rights.min_by(&:x).x, 1)
  end
end
unless lefts.empty?
  if lefts.size == 1
    x_way << Way.new(lefts[0].x, -1)
  else
    x_way << Way.new(lefts.max_by(&:x).x, -1)
    x_way << Way.new(lefts.min_by(&:x).x, -1)
  end
end

x_flat = ups + downs
unless x_flat.empty?
  if x_flat.size == 1
    x_way << Way.new(x_flat[0].x, 0)
  else
    x_way << Way.new(x_flat.max_by(&:x).x, 0)
    x_way << Way.new(x_flat.min_by(&:x).x, 0)
  end
end

y_way = []
unless ups.empty?
  if ups.size == 1
    y_way << Way.new(ups[0].y, 1)
  else
    y_way << Way.new(ups.max_by(&:y).y, 1)
    y_way << Way.new(ups.min_by(&:y).y, 1)
  end
end
unless downs.empty?
  if downs.size == 1
    y_way << Way.new(downs[0].y, -1)
  else
    y_way << Way.new(downs.max_by(&:y).y, -1)
    y_way << Way.new(downs.min_by(&:y).y, -1)
  end
end

y_flat = lefts + rights
unless y_flat.empty?
  if y_flat.size == 1
    y_way << Way.new(y_flat[0].y, 0)
  else
    y_way << Way.new(y_flat.max_by(&:y).y, 0)
    y_way << Way.new(y_flat.min_by(&:y).y, 0)
  end
end

times = [0.0]
x_way.combination(2) do |a, b|
  next if a.dx == b.dx
  time = ((a.x - b.x) * -1.0) / (a.dx - b.dx)
  next if time < 0
  times << time
end

y_way.combination(2) do |a, b|
  next if a.dx == b.dx
  time = ((a.x - b.x) * -1.0) / (a.dx - b.dx)
  next if time < 0
  times << time
end

ans = 10**100
times.each do |t|
  x_max = x_way.map { |w| w.x + w.dx * t }.max * 1.0
  x_min = x_way.map { |w| w.x + w.dx * t }.min * 1.0
  y_max = y_way.map { |w| w.x + w.dx * t }.max * 1.0
  y_min = y_way.map { |w| w.x + w.dx * t }.min * 1.0
  ans = [ans, (x_max - x_min) * (y_max - y_min)].min
end

puts ans


Measured memory_bytes: 17276
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair <int, int>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  double sum=0;
  rep(i,N){
    int A;
    cin >> A;
    sum += 1.0/A;
  }

  cout << fixed << setprecision(10) << 1.0/sum << endl;


}


Measured memory_bytes: 256
/* 
  ╔╗         ╔╗              ╔═══╗                                  
  ║║        ╔╝╚╗             ║╔═╗║                                  
  ║║╔╗╔╗╔══╗╚╗╔╝    ╔══╗     ║╚═╝║╔═╗╔══╗╔══╗╔═╗╔══╗ ╔╗╔╗╔╗╔╗╔══╗╔═╗
╔╗║║║║║║║══╣ ║║     ╚ ╗║     ║╔══╝║╔╝║╔╗║║╔╗║║╔╝╚ ╗║ ║╚╝║║╚╝║║╔╗║║╔╝
║╚╝║║╚╝║╠══║ ║╚╗    ║╚╝╚╗    ║║   ║║ ║╚╝║║╚╝║║║ ║╚╝╚╗║║║║║║║║║║═╣║║ 
╚══╝╚══╝╚══╝ ╚═╝    ╚═══╝    ╚╝   ╚╝ ╚══╝╚═╗║╚╝ ╚═══╝╚╩╩╝╚╩╩╝╚══╝╚╝ 
                                         ╔═╝║                       
                                         ╚══╝                       */


//Header files
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#ifndef ONLINE_JUDGE
#include<Personal/debug.h>
#else
#define debug(x...)
#endif

//Short data-types declaration
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vii;  
typedef vector<vector<long long> >vll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vbb;

//Macros
#define MK make_pair
#define EB emplace_back
#define PB push_back
#define F first
#define S second
#define rep(i,start,end) for(int i=(int)start;i<(int)end;i++)
#define repr(i,start,end) for(int i=(int)start;i>(int)end;i--)
#define all(x) (x).begin(), (x).end()

//Constants
const int mod = 1e9+7;

//Some useful functions
ll binpow(ll num,ll pow);
inline int mul(int a,int b) {return (a*1ll*b)%mod;}
inline int add(int a,int b) {return (a+0ll+b)%mod;}
inline int sub(int a,int b) {return ((a+0ll-b)%mod+mod)%mod; }
/*------------------------------------------------------Code Starts------------------------------------------------------*/
inline void solve()
{
	int h,w,k;
	cin>>h>>w>>k;
	vs c(h);
	rep(i,0,h) cin>>c[i];
	int ans=0;
	debug(c);
	rep(R,0,(1<<h))
	{
		rep(C,0,(1<<w))
		{
			debug(R,C);
			int b=0;
			rep(i,0,h)
			{
				rep(j,0,w)
				{
					debug(i,j);
					if(((R>>i)&1)==0 and ((C>>j)&1)==0 and c[i][j]=='#')
						b++;
				}
			}
			debug(b);
			if(b==k) ans++;
		}
	}
	cout<<ans<<'\n';
}

int main()
{
	auto start = high_resolution_clock::now();
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start); 
	cerr<<duration.count()<<" microseconds\n";
	return 0;
}
/*------------------------------------------------------Code ends------------------------------------------------------*/
ll binpow(ll num,ll pow)
{
	if(pow==0)
		return 1;
	ll val=binpow(num,pow/2);
	val*=val;
	if(pow&1) val*=num;
	return val;
}



Measured memory_bytes: 3604
#include<stdio.h>
int main(void)
{
  char b;
 
  scanf("%s",&b);
  
  if(b == 'A')
    printf("T\n");
  if(b == 'T')
    printf("A\n");
  if(b == 'C')
    printf("G\n");
  if(b == 'G')
    printf("C\n");
  
  return 0;
}

Measured memory_bytes: 128
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
    (0..b).each do |j|
        (0..c).each do |k|
            cnt += 1 if i * 500 + j * 100 + k * 50 == x
        end
    end
end

puts cnt

Measured memory_bytes: 1788
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]>=thresh:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


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

int main()
{
  int l;
  cin>>l;
  
  if(l&1)
  {
  cout<<"No";
  return 0;
  }
  string str;
  cin>>str;
  
  for(int i=0;i<l/2;i++)
  if(str[i]!=str[i+(l/2)])
  {
  cout<<"No";
  return 0;
  }
 cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
//Volume5-0502
import java.util.*;

class Main {
	
	private static int[][][] t = {{{1,2,3},{2,3,4}},
		                          {{2,2,0},{5,4,2}},
		                          {{0,0,3},{1,3,5}}};
	
	private static int[] dice;
	private static int   sum;
	
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int n;
		String s;
		while((n=sc.nextInt())!=0){
			init();
			while(n-- > 0){
				s=sc.next();
				if     (s.equals("North")){change(0,0);}
				if     (s.equals("South")){change(0,1);}
				else if(s.equals("East")) {change(1,0);}
				else if(s.equals("West")) {change(1,1);}
				else if(s.equals("Right")){change(2,0);}
				else if(s.equals("Left")) {change(2,1);}
				sum+=dice[2];
			}
			System.out.println(sum);
		}
	}

	private static void init(){
		sum  = 1;
		dice = new int[6];
		int[] init = {4,5,1,2,6,3}; 
		for(int i=0;i<6;i++){
			dice[i] = init[i];
		}
	}

	private static void change(int a,int b){
		int init,limit,incr;
		if   (b==0){init=0; limit=3 ; incr= 1;}
		else       {init=2; limit=-1; incr=-1;}
		for(int i=init;i!=limit;i+=incr){
			swap(t[a][0][i],t[a][1][i]);
		}
	}
	
	private static void swap(int i,int j){
		dice[j]  = dice[i] - dice[j];
		dice[i] -= dice[j];
		dice[j] += dice[i];
	}
}

Measured memory_bytes: 25316
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    REP(i, 0, N) {
        REP(j, 0, N) {
            int remain = N - R * i - j * G;
            if(remain < 0) continue;
            if(remain % B == 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define PI 3.141592653589793238
#define INF 1050000000

using namespace std;



//cout << fixed << setprecision(15) << << endl;
//cout << << endl;

int main() {

	int N;

	cin >> N;

	int a,b,c,K;
  
    a = N%10;
    b = (N/10)%10;
    c = N/100;
  
    K = a*100+b*10+c;
  
    if(K==N){
      cout << "Yes" <<endl;
    }else{
      cout << "No" <<endl;
    }


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

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

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;



int main() {
  int N;
  cin >> N;
  int colors[10]; // 8

  REP(i, 10) {
    colors[i] = 0;
  }

  int pros = 0;

  REP(i, N) {
    int score;
    cin >> score;

    if (score >= 3200) {
      pros += 1;
    } else {
      colors[score / 400] += 1;
    }
  }

  int cnum = 0;
  REP(i, 8) {
    if (colors[i] > 0) {
      cnum++;
    }
  }

  int mn = max(cnum, 1);
  int mx = cnum + pros;

  cout << mn << " " <<  mx << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,m,n) for(int i=m;i<n;i++)
#define repr(i,n,m) for(int i=n;i>=m ;i--)
#define MOD 1000000007
#define float long double
#define pb push_back
#define mp make_pair
#define pp pop_back
#define pi 3.141592653589793238
#define print(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl;
using namespace std;
bool sortbysec(const pair<int,int> &a,
             const pair<int,int> &b)
{
   return (a.second < b.second);
}
int lcm(int a, int b)  
 {  
    return (a*b)/__gcd(a, b);  
 }  
bool sortinrev(const pair<int,int> &a,  
              const pair<int,int> &b)
{
      return (a.first > b.first);
}
void solve()
{
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes";
	else
		cout<<"No";
}    
signed main()
{
                     // #ifndef ONLINE_JUDGE
                     // freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
                     // #endif 
  int t=1;
 //cin>>t;
  while(t--){
  solve();
  cout<<"\n";
}
  cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
 return 0;
}  


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

int main() {
  long N, i, j, k, R, G, B;
  R = 0;
  G = 0;
  B = 0;
  string S;
  cin >> N >> S;
  // if (N == 1 || N == 2 || N == 3) {
  //   cout << '0' << endl;
  // }
  for (i = 0; i < N; i++) {
    if (S[i] == 'R') {
      R++;
    } else if (S[i] == 'G') {
      G++;
    } else {
      B++;
    }
  }
  long tmp = 0;
  for (i = 0; i <= ((N - 3) / 2); i++) {
    for (j = 0; j < N - i - i - 2; j++) {
      if (S[j] != S[j + i + 1] && S[j + i + 1] != S[j + i + i + 2] &&
          S[j] != S[j + i + i + 2]) {
        tmp++;
      }
    }
  }
  cout << (R * B * G) - tmp << endl;
}

Measured memory_bytes: 3640
N,W = map(int, input().split())
v = [0]*N; w = [0]*N
for i in range(N):
    v[i], w[i] = map(int, input().split())

DP = [0]*(W+1)
for i in range(N):
    weight = w[i]
    value = v[i]
    for sum_w in range(1, W+1):
        if sum_w - weight >= 0:
            DP[sum_w] = max(DP[sum_w], DP[sum_w - weight] + value)
print(DP[-1])


Measured memory_bytes: 5720
#include <iostream>

int gcd(int x, int y) {
    if (x < y) {
        std::swap(x, y);
    }

    for (int r; y != 0;) {
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main() {
    int x, y;
    std::cin >> x >> y;

    std::cout << gcd(x, y) << '\n';
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define ll long long
#define ldb long double
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mpa make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)


const int MOD = 1e9+7;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n){
	ll res=1;

	while(n){
		if(n%2)
		res*=a;
		a*=a;
		n/=2;
	}
	
	return res;
}

ll int h=power(10,10);

ll int fun(int x,int*a,ll int*dp,int k){
	if(x<=0)
	return 0;
	
	if(dp[x]==-1){
		ll int ans=h;
		for(int i=0;i<k;i++){
			ans=min(fun(x-i-1,a,dp,k)+abs(a[x]-a[max(0,x-i-1)]),ans);
		}
		
		dp[x]=ans;
	}
	
	return dp[x];
}

int main(){
	fast;
	
	int n;
	cin>>n;
	
	int a[n],b[n],c[n];
	forr(i,0,n)
	cin>>a[i]>>b[i]>>c[i];
	
	ll int dp[n+1][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	
	for(int i=1;i<n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	
	ll int x=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	cout<<x;
	
	return 0;
}

Measured memory_bytes: 3840
#include <stdio.h>

int main(){
  int N;
  int A[300000]={0};
  long long int xorA[300000]={0};
  long long int sumA[300000]={0};
  int index=1;
  long long int count=0;
  
  scanf("%d",&N);
  for(int i=1;i<=N;i++)
    scanf("%d",&A[i]);

  for(int i=1;i<=N;i++){
    sumA[i]=sumA[i-1]+A[i];
    xorA[i]=xorA[i-1]^A[i];
    for(int j=index;j<=i;j++,index++)
      if((sumA[i]-sumA[j-1])==(xorA[i]^xorA[j-1]))
	break;
    count+=(i-index)+1;
  }

  printf("%lld\n",count);
  return 0;
    
}



Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define N (100005)
#define ll long long
#define itn int
#define scafn scanf
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define CM cerr<<(&MOP2-&MOP1)/1024.0/1024.0<<endl
using namespace std;
template <class T> inline T Min(T x, T y){
    return x<y?x:y;
}
template <class T> inline T Max(T x, T y){
    return x>y?x:y;
}
bool MOP1;
int n,m;
struct node{
	int cost,val;
	bool operator < (const node &a)const{
		return val==a.val?cost<a.cost:val>a.val;
	}
	void read(){
		scanf("%d%d",&cost,&val);
	}
	void deb(){
		printf("%d %d\n",cost,val);
	}
}A[N];
int f[N];
int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
int ans;
bool MOP2;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)A[i].read();
	for(int i=1;i<=m+1;i++)f[i]=i;
	sort(A+1,A+1+n);
//	for(int i=1;i<=n;i++)A[i].deb();
	for(int i=1;i<=n;i++){
		int c=A[i].cost;
		int v=A[i].val;
		if(c>m)continue;
		int now=find(f[c]);
		if(now>m)continue;
		ans+=v,f[now]++;
	}
	printf("%d\n",ans);
	return 0;
}






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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
//const int inf = pow(2, 62);
//const int mod = 1e9 + 7;
const int mod = 100000;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


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




/* main */



signed main(){

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

    
    set<int> s;

    rep(i,0,3) s.insert(input());

    print(s.size());


    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a[3];rep(i,0,3)cin>>a[i];
  sort(a,a+3);

  if(a[1]-a[0]==a[2]-a[1])out("YES")
  else out("NO")

  return 0;
}


Measured memory_bytes: 256