akhauriyash/Code-Regression huggingface dataset:
class UNION_FIND(object):
    def __init__(self,n):
        #親の番号を格納する。親だった場合は-(その集合のサイズ)
        #作るときはParentの値を全て-1にする
	    #こうすると全てバラバラになる
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        #Aがどのグループに属しているか調べる
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])
            return self.parent[x]

    def size(self,x):
        #自分のいるグループの頂点数を調べる
        return -self.parent[self.root(x)]   #親をとってきたい
        
    def union(self,x,y):
        #AとBをくっ付ける
        #AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        #print(self.parent)
        x=self.root(x)
        y=self.root(y)
        #print(x,y)
        if x==y:   #すでにくっついてるからくっ付けない
            return False
            
        #大きい方(A)に小さいほう(B)をくっ付けたい
		#大小が逆だったらひっくり返しちゃう。
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True



n,m=map(int,input().split())
uni=UNION_FIND(n)
ans=n*(n-1)//2

Input=[]
anslist=[ans]
for s in m*[0]:
    a,b=map(int,input().split())
    Input.append([a-1,b-1])

for i in range(m-1,0,-1):
    x=Input[i][0]
    y=Input[i][1]
    #print(x,y)
    if uni.root(x) != uni.root(y):
        ans-=uni.size(x)*uni.size(y)
        uni.union(x,y)
    anslist.append(ans)

for t in anslist[::-1]:
    print(t)

Measured memory_bytes: 26812
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>

using namespace std;
const long long int MOD=1e9+7;

int main(){
  long long  h, w, a, b;
  cin >> h >> w >> a >> b;
  if(a!=0 && b!=0 && h%b==0 && w%a==0 && h*a == w*b){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if((i/b)*a<=j && j<(i/b)*a+a)cout << 1;
        else cout << 0;
      }
      cout << endl;
    }
  }
  else if(a!=0 && b!=0){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if((j<a && i<b) || (j>=a && i>=b))cout << 1;
        else cout << 0;
      }
      cout << endl;
    }
  }
  else if(a==0 && b==0){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cout << 1;
      }
      cout << endl;
    }
  }
  else if(a==0 && b!=0){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(0<=i && i<b)cout << 1;
        else cout << 0;
      }
      cout << endl;
    }
  }
  else if(a!=0 && b==0){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(0<=j&& j<a)cout << 1;
        else cout << 0;
      }
      cout << endl;
    }
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m;
  while(1){
    cin >> n >> m;
    if(n==0ll and m==0ll) break;
    long long p[m][n];
    for(int i=0;i<m;i++){
      for(int j=0;j<n;j++){
        cin >> p[i][j];
      }
    }
    long long ans=0;
    for(int i=0;i<n;i++){
      long long sum=0;
      for(int j=0;j<m;j++){
        sum+=p[j][i];
      }
      ans=max(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;

#define F 						first
#define PB 						push_back
#define MP 						make_pair
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon					1e-9

constexpr ll int_pow(ll b, ll e) {
    return (e == 0) ? 1 : b * int_pow(b, e - 1);
}

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int main()
{
	doublade();
	// w(t) {
		ll x, y;
		cin>>x>>y;
		ll c = (4*x-y)/2;
		ll t = (y-2*x)/2;
		if(((4*x-y)%2==0 && (y-2*x)%2==0) && ((4*x-y)>=0 && (y-2*x)>=0)) {
			cout<<"Yes\n";
		}else cout<<"No\n";
	// }
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int main() {
	string str;
	cin >> str;
	int n = 0;
	for (string::iterator a = str.begin();a != str.end();++a) {
		if (n % 2 == 0)
			cout << *a;
		n++;
	}
	cout << endl;

	return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  if (s.size() & 1) {
    puts("No");
    return 0;
  }
  bool ok = 1;
  for (int i = 0; i < (int)s.size(); i += 2) {
    ok &= s[i] == 'h' && s[i+1] == 'i';
  }
  puts(ok ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>

using namespace std;


int main() {
  int r, D, x[11];
  cin >> r >> D >> x[0];
  
  for (int i = 1; i <= 10; i++) {
    x[i] = r*x[i-1] - D;
    cout << x[i] << endl;
  }

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    int h[n+1];
    for(int i=1;i<n+1;i++){
        cin >> h[i];
        if(i==1){
            h[i]-=1;
            continue;
        }
        if(h[i]>h[i-1]) h[i]-=1;
        if(h[i]<h[i-1]){
            cout << "No" << endl;
            return 0;
        }
    }
        
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 640
import math

inputs = list(map(int, input().split()))
a = inputs[0]
b = inputs[1]
x = inputs[2]

l = a * a * b
d = x / l
if d <= 0.5:
  h = 2 * a * d
  atan = (math.degrees(math.atan(b/h)))
  print(round(atan, 6))
else:
  h = 2 * b * (1-d)
  atan = (math.degrees(math.atan(h/a)))
  print(round(atan, 6))

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

int main()
{
    int n;
    cin >> n;
    n %= 10;
    if (n == 3)
    {
        cout << "bon" << endl;
    }
    else if (n == 0 || n == 1 || n == 6 || n == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
import qualified Data.ByteString.Char8 as B
import           Data.Char
import           Data.List             as L

main :: IO ()
main = do
  [n, m] <- map read.words <$> getLine
  xs <- L.unfoldr (B.readInt.B.dropWhile isSpace) <$> B.getLine
  print $ solve m xs

solve :: Int -> [Int] -> Int
solve m xs = sum
    . map ((\l -> l * (l - 1) `quot` 2) . length)
    . L.group
    . L.sort
    $ scanl (\x y -> (x + y) `rem` m) 0 xs

Measured memory_bytes: 13564
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;

int n, b;
vector<int> a;
vector<bool> m;

int main(){
    a.resize(9);
    for (int i = 0; i < 9; ++i){
        cin >> a[i];
        m.push_back(false);
    }
    cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> b;
        auto iter = find(a.begin(), a.end(), b);
        if (iter != a.end()){
            int j = distance(a.begin(), iter);
            m[j] = true;
        }
    }
    if (
        (m[0] && m[3] && m[6]) ||
        (m[1] && m[4] && m[7]) ||
        (m[2] && m[5] && m[8]) ||
        (m[0] && m[1] && m[2]) ||
        (m[3] && m[4] && m[5]) ||
        (m[6] && m[7] && m[8]) ||
        (m[0] && m[4] && m[8]) ||
        (m[2] && m[4] && m[6])
    ) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <climits>
#include <math.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;

const ll M = pow(10,9)+7;

vector<ll> fac(1000001); //n!(mod M)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll dupc(ll a,ll b){
    if(a == 0 && b == 0)return 1;
    if(a < 0 || b == 0)return 0;
    ll tmp = ifac[a-1]* ifac[b] % M;
    return tmp * fac[a+b-1] % M;
}

int main() {
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<1000000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M)
    }
    int s;
    ll ans=0;
    cin>>s;
    if(s<=2){
        cout<<0<<endl;
        return 0;
    }
    int x=s/3,y=s%3;
    if(y==0){
        ans++;
    }
    while(x>0){
        ans+=dupc(x,y);
        ans%=M;
        x--;
        y+=3;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 18652
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll calc(ll sum,ll a,ll b){
    if(a > b) return 0;
	ll ret = max(a * (sum-a) , b * (sum-b));
	if(a <= sum/2 && sum/2 <= b){
		ret = max(ret, sum/2 * (sum - sum/2) );
	}
	return ret;
}
int main(){
	int q; cin >> q;
	while(q--){
		ll a,b; cin >> a >> b;
		if(a > b) swap(a,b);
		ll lb = a-1, ub = 2*b+5;
		while(ub-lb > 1){
			ll mid = (lb+ub)/2;
			//1..a-1 a+1...mid
			//mid....b+1 b-1...1
			ll mx = 0;
			if(a-1 <= mid-b){
				mx = max(mx,calc(mid+1,1,a-1));
				mx = max(mx,calc(mid+2,a+1,mid-b+1));
				mx = max(mx,calc(mid+1,mid+2-b,mid));
			}
			else{
				mx = max(mx,calc(mid+1,1,mid-b));
				mx = max(mx,calc(mid,mid-b+1,a-1));
				mx = max(mx,calc(mid+1,a+1,mid));
			}
			
			if(mx < a*b) lb = mid;
			else ub = mid;
		}
		cout << lb-1 << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
S = input()
es = [0]
for c in S:
    es.append(es[-1] + (c=='W'))

ans = N
for i in range(N):
    tmp = (N-i-1) - (es[N] - es[i+1])
    tmp += es[i]
    ans = min(ans,tmp)
print(ans)


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int>v(101);
	for(int i=1;i<101;i++){
		v.at(i)=v.at(i-1)+i;
	}
	int n,m,ans=0;
	cin>>n>>m;
	if(n>=2){
		ans+=v.at(n-1);
	}
	if(m>=2){
		ans+=v.at(m-1);
	}
	cout<<ans<<endl;
}


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

int main(void){
    int A,B,C,K,flag=0;
    cin >> A>>B>>C>>K;
    while(A>=B){
        B*=2;
        flag++;
    }
    while(B>=C){
        C*=2;
        flag++;
    }
    if(flag<=K) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>

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

    std::vector<std::string> table(h);
    for (int i = 0; i < h; i++) {
        std::cin >> table[i];
    }

    std::vector<std::vector<int>> num_table(h, std::vector<int>(w, 0));

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (table[i][j] == '#') {
                num_table[i][j] = -1;
            }
        }
    }

    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (table[y][x] == '#') {
                for (int y_offset = -1; y_offset <= 1; y_offset++) {
                    for (int x_offset = -1; x_offset <= 1; x_offset++) {
                        if (y_offset == x_offset && y_offset == 0) {
                            continue;
                        }

                        if (y + y_offset >= 0 && y + y_offset < h && x + x_offset >= 0 && x + x_offset < w && num_table[y + y_offset][x + x_offset] != -1) {
                            num_table[y + y_offset][x + x_offset]++;
                        }
                    }
                }
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (num_table[i][j] == -1) {
                std::cout << '#';
            } else {
                std::cout << num_table[i][j];
            }
        }
        putchar('\n');
    }
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
    int a;
    cin >> a;
    cout << a / 3600 << ":";
    a %= 3600;
    cout << a / 60 << ":";
    a %= 60;
    cout << a << endl;
    return 0;
}



Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		/**
		if(a == b) {
			System.out.println(a + b);
		}else {
			int res = Math.max(a, b) * 2 -1;
			System.out.println(res);
		}
		**/

		int ans = 0;
		ans = Math.max(ans, a + a -1);
		ans = Math.max(ans, a + b);
		ans = Math.max(ans, b + b -1);

		System.out.println(ans);


	}

}

Measured memory_bytes: 21972
n, _ = map(int, input().split())
CST = {} # {c:[[s,t],...]}
for i in range(n):
    s, t, c = map(int, input().split())
    if c in CST: CST[c] += [[s,t]]
    else: CST[c] = [[s,t]]
mx_t = 200002
R = [0]*mx_t
for c, ST in CST.items():
    TZ = [0]*mx_t
    for s,t in ST:
        TZ[2*s - 1] += 1
        TZ[2*t] -= 1
    for i in range(mx_t - 1):
        TZ[i+1] += TZ[i]
        if TZ[i+1] > 0: R[i+1] += 1
print(max(R))


Measured memory_bytes: 136552
import std.functional,
       std.algorithm,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

ulong M = 10UL^^9 + 7;

ulong fact(ulong n) {
  if (n <= 1) { return 1; }
  else {
    return n * fact(n - 1) % M;
  }
}

void main() {
  ulong n = readln.chomp.to!ulong;

  writeln(fact(n));
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi, greater<int>> mpq;

const ll INF = 1e18;
const int mod = 1e9+7;
const int dX[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ft front()
#define bk back()
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define FOR(i, a) for(int i = 0; i < a; i++)
#define FoR(i, a) for(int i = 1; i <= a; i++)
#define ROF(i, a) for (int i = (a)-1; i >= 0; i--)

int main(){
    int n; cin >> n;
    vector<int> dp(n+5, 1e9+5); // dp[i] = cost incurred up to that index
    int heights[n];
    for(int& x : heights){
        cin >> x;
    }
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j : {i+1, i+2}){
            if(j < n){
                dp[j] = min(dp[j], dp[i] + abs(heights[i] - heights[j]));
            }
        }
    }
    cout << dp[n-1] << endl;
    return 0;
    // Read nutes to self
}

/* NOTES TO SELF:
 * Check for int vs ll, worst case just switch everything to ll
 * Check for array bounds if you SEGFAULT, especially in range based loops
 * Always initialize everything in global 
 * Edge cases such as n = 1 or 0
 * Make sure to calculate big O complexity
 * You are geniosity you got this
 */





Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  int N,K,X,Y,price;
  cin >> N;
  cin >> K;
  cin >> X;
  cin >> Y;
  for(int i = 0;i<N;i++){
    if(i<K){
      price+=X;
    }else{
      price+=Y;
    }
  }
    cout << price;


  
}

Measured memory_bytes: 256
import numpy as np

N,M=list(map(int, input().split()))
A=[]
ret=[]
T=[[1,1,1],[1,1,-1],[1,-1,1],[-1,1,1],[1,-1,-1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
for i in range(N):
    l=list(map(int, input().split()))
    l.append(0)
    A.append(l)

def Score(a):
    return abs(a[0])+abs(a[1])+abs(a[2])

for t in T:
    for a in A:
        a[3]=a[0]*t[0]+a[1]*t[1]+a[2]*t[2]
    A.sort(key=lambda x:x[3],reverse=True)
    score=0
    for _ in range(M):
        score+=A[_][3]
    ret.append(score)
ret.sort(reverse=True)
print(ret[0])

Measured memory_bytes: 12912
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll x;
  cin>>x;
  vll a(0);
  a.pb(0);
  ll cu=1;
  while(cu*cu*cu*cu*cu<=1e18){
    a.pb(cu*cu*cu*cu*cu);
    cu++;
  }
  rep(i,sz(a)){
    for(int j=i+1;j<sz(a);j++){
      if(a[j]-a[i]==x){
        cout<<j<<" "<<i<<endl;
        return 0;
      }
      else if(a[j]+a[i]==x){
        cout<<j<<" "<<-1*i<<endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3688
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define endl "\n";
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;
bool sortbysec(const pair<string,pair<int,int> > &a, const pair<string, pair<int,int> > &b) 
{ 
    if(a.first > b.first)   return 1;
	if(a.first == b.first && a.second.first < b.second.first) return 1;
	return 0;
} 
 
int main(){
	migmig;
	vector<pair<string,pair<int,int> > >v;
	int n;
	cin>>n;
	string x;
	int y;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		v.pb( make_pair(x,make_pair(y,i)));
	}
	 sort(v.begin(), v.end(),sortbysec); 
	  for (int i=n-1; i>=0; i--) 
    { 
        cout << v[i].second.second << endl; 
    } 
	
	
	
	return 0;
}


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


int main(){
  unsigned long long x;
  cin>>x;

  unsigned long long ans = 100;
  int count =0;
  while(ans<x){
    unsigned long long a = ans/100;
    ans+=a;
    ++count;
  }

  cout <<count<<endl;


}


Measured memory_bytes: 3620
#define NDEBUG

#include <bits/stdc++.h>

using namespace std;
using pii = pair<int, int>;

#ifdef NDEBUG
#  define debug(...)
#else
#  include "debug.hh"
#endif

const int N = 1000;
int n, x[N], y[N];

void move(int i, int len) {
  if (abs(x[i]) > abs(y[i])) {
    if (x[i] > 0) {
      cout << 'R';
      x[i] -= len;
    } else {
      cout << 'L';
      x[i] += len;
    }
  } else {
    if (y[i] > 0) {
      cout << 'U';
      y[i] -= len;
    } else {
      cout << 'D';
      y[i] += len;
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  bool odd = (abs(x[0]) + abs(y[0])) % 2;
  for (int i = 1; i < n; i++) {
    if ((abs(x[i]) + abs(y[i])) % 2 != odd) {
      cout << "-1\n";
      return 0;
    }
  }
  int m = 31 + !odd;
  cout << m << '\n';
  if (!odd) cout << "1 ";
  for (int k = 30; k >= 0; k--) cout << (1<<k) << (k == 0 ? '\n' : ' ');
  for (int i = 0; i < n; i++) {
    if (!odd) move(i, 1);
    for (int k = 30; k >= 0; k--) move(i, 1<<k);
    assert(x[i] == 0);
    assert(y[i] == 0);
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;
#define all(v) v.begin(),v.end()
#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve(){
  ll n;
  cin>>n;
 vll v(n);
 map<ll,ll>mp;
 fr(i,0,n)
 cin>>v[i];
 for(int i=0;i<n;i++){
   mp[i+v[i]]++;
  // mp[-i+v[i]]++;
 }
 ll ans=0;
 for(int i=0;i<n;i++){
   ans+=mp[i-v[i]];
   ans+=mp[-i-v[i]];


 }
 cout<<ans;

}
int main()
{
    ll t=1;
  //  cin>>t;
    while(t--)
    {
     solve();
     cout<<endl;
    }
	return 0;
}

Measured memory_bytes: 38536
#include <iostream>
#include <vector>
#include <string>

using namespace std;

const int MOD = 998244353;

int main(){
    int N;
    while(cin >> N){
        string S; cin >> S;
        vector<int> cnt(256, 0);
        long long res = 1;
        for(int i=1;i<=N;i++) res = (res * i) % MOD;
        for(auto c : S){
            int cur = cnt[c];
            int next = 3*N;
            for(auto t : "RGB"){
                if(t == c) continue;
                if(cnt[t] > cur) next = min(next, cnt[t]);
            }
            if(next != 3*N){
                res = (res * (next - cur)) % MOD;
            }
            ++cnt[c];
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 900
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    while(1){
        int n,x;
        cin>>n>>x;
        if(n==0&&x==0)break;
        ll ans=0;
        REP(i,1,n+1)REP(j,i+1,n+1)REP(k,j+1,n+1){
            if(i+j+k==x)++ans;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
const int INF = 1000100100;
 
 
int main(){
    ll n;
    string s;
    cin>>s;
    n=s.size();
    if(s[n-1]=='s'){
        cout<<s<<"es"<<endl;
    }else{
        cout<<s<<"s"<<endl;
    }
}

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

int N;
int Pk,Qk;

int dfs(vector<int> &A, vector<bool> seen, int depth, int count, vector<vector<int>> &perm){
  if(depth == N){
    perm.push_back(A);
    return count+1;
  }
  int same = 0;
  for(int i = 0; i < N; i++){
    if(seen[i]) continue;
    A[depth] = i+1;
    seen[i] = true;
    count = dfs(A,seen,depth+1,count,perm);
    seen[i] = false;
  }
  return count;
}

int main(){
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  for(int i = 0; i < N; i++) cin >> P[i];
  for(int i = 0; i < N; i++) cin >> Q[i];
  vector<bool> seen(N);
  vector<int> A(N);
  vector<vector<int>> perm = {};
  dfs(A,seen,0,0,perm);
  int Pk = 0;
  int Qk = 0;
  for(int j = 0; j < perm.size(); j++){
    int sameP = 0;
    int sameQ = 0;
    for(int i = 0; i < N; i++){
      if(P[i] == perm[j][i]) sameP += 1;
      if(Q[i] == perm[j][i]) sameQ += 1;
    }
    if(sameP == N) Pk = j;
    if(sameQ == N) Qk = j;
  }
  cout << abs(Pk-Qk) << endl;
}


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

int main() {
	int n;
	int ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i < 10) {
			ans += 1;
		}
		else if (99 < i && i < 1000) {
			ans += 1;
		}
		else if (9999 < i && i < 100000) {
			ans += 1;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

const int n = 3;
int a[n];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	for(int i = 0; i < n - 1; i++) cin >> a[i];
	
	a[n - 1] = 4;
	sort(a, a + n);
	
	for(int i = 0; i < n; i++){
		if(a[i] != i + 1){
			cout << (i + 1) << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	double x1, y1, x2, y2, xq, yq; char c;
	while (cin >> x1 >> c >> y1 >> c >> x2 >> c >> y2 >> c >> xq >> c >> yq) {
		complex<double>p1(x1, y1), p2(x2, y2), q(xq, yq), r;
		r = p1+polar(abs(p1-q), 2*arg(p2-p1)-arg(q-p1));
		printf("%.4f %.4f\n", r.real(), r.imag());
	}
	return 0;
}

Measured memory_bytes: 3544
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <sstream>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define LL          long long
# define pr          pair
# define mkp         make_pair
# define lowbit(x)   ((x)&(-x))
# define PI          acos(-1.0)
# define INF         0x3f3f3f3f
# define eps         1e-8
# define MOD         1000000007

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
# define MX 205
/**************************/

int n,m,R;
int ans;
int goal[MX];
int mp[MX][MX];
int G[25][25];
int dp[15][(1<<15)];

void floyd()
{
    for (int k=1;k<=n;k++)
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++)
                if (mp[i][j]>mp[i][k]+mp[k][j])
                    mp[i][j] = mp[i][k]+mp[k][j];
}

int main()
{
    scanf("%d%d%d",&n,&m,&R);
    for (int i=1;i<=R;i++)
        goal[i] = scan();
    memset(mp,0x3f,sizeof(mp));
    for (int i=1;i<=m;i++)
    {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        mp[a][b] = mp[b][a] = c;
    }

    floyd();
    for (int i=1;i<=R;i++)
        for (int j=1;j<=R;j++)
            G[i][j] = mp[ goal[i] ][ goal[j] ];

    memset(dp,0x3f,sizeof(dp));
    for (int i=1;i<=R;i++)
        dp[i-1][(1<<(i-1))] = 0;

    for (int i=0;i<(1<<R);i++) //sta
        for (int j=1;j<=R;j++)
            if ((1<<(j-1))&i) //qi
                for (int k=1;k<=R;k++) //zhong
                    dp[k-1][i|(1<<(k-1))]=min(dp[k-1][i|(1<<(k-1))],dp[j-1][i]+G[j][k]);

    int ans = INF;
    for (int i=1;i<=R;i++)
        ans=min(ans,dp[i-1][(1<<R)-1]);
    printf("%d\n",ans);
}


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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream &operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }
template<typename T>
T lcm(T a, T b) { if(a==0 or b==0) return 0; return a/gcd(a, b)*b; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 1e15;
const int modn = 1e9+7;
const int maxn = 2e5+3;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    cout << fixed << setprecision(15);
    int n;
    cin>>n;
    vector<ld> a(n+1);
    for(int i=1; i<=n; i++) {
        cin>>a[i];
    }
    vector<vector<ld> > dp(n+1, vector<ld>(n+1));
    dp[0][0] = 1;
    for(int i=1; i<=n; i++) {
        dp[i][0] = (1-a[i])*dp[i-1][0];
        for(int j=1; j<=n; j++) {
            dp[i][j] = a[i]*dp[i-1][j-1] + (1- a[i])*dp[i-1][j];
        }
    }
    ld ans = 0;
    for(int i=n/2+1; i<=n; i++) {
        ans += dp[n][i];
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 141056
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N = int(input())
T = [0] + list(map(int, input().split()))
V = [0] + list(map(int, input().split()))

max_speed_from_left = [0] * (N + 1)
max_speed_from_right = [0] * (N + 1)

for i in range(1, N):
    start = max_speed_from_left[i - 1]
    max_speed_from_left[i] = min(start + T[i], V[i], V[i + 1])

for i in range(N - 1, 0, -1):
    start = max_speed_from_right[i + 1]
    max_speed_from_right[i] = min(start + T[i + 1], V[i], V[i + 1])

speed = [min(x, y) for x, y in zip(max_speed_from_left, max_speed_from_right)]

def dist(left_speed, right_speed, t, v):
    x = (v - left_speed) + (v - right_speed)
    if x >= t:
        v = (left_speed + right_speed + t) / 2
        x = t
    d = (left_speed + v) * (v - left_speed) / 2
    d += v * (t - x)
    d += (right_speed + v) * (v - right_speed) / 2
    return d

ans = 0
for i in range(1, N + 1):
    ans += dist(speed[i - 1], speed[i], T[i], V[i])

print (ans)

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

int  N, A, B, C, D;
string S;

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

  cin >> N >> A >> B >> C >> D;
  cin >> S;

  bool ans = true;
  for (int i=A; i<C; ++i) {
    if (S[i-1] == '#' && S[i] == '#') {
      ans = false;
      break;
    }
  }
  for (int i=B; i<D; ++i) {
    if (S[i-1] == '#' && S[i] == '#') {
      ans = false;
      break;
    }
  }
  if (D < C) {
    bool jump = false;
    for (int i=B; i<=D; ++i) {
      if (S[i-2] == '.' && S[i-1] == '.' && S[i] == '.') {
        jump = true;
        break;
      }
    }
    if (!jump) ans = false;
  }
  if (ans) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#define FI(__n) for(int i = 0; i < __n; ++i)
#define FJ(__n) for(int j = 0; j < __n; ++j)
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define l first
#define r second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD=1000000007;
int solve()
{
    int a;
    cin>>a;
    cout<<"ABC"<<a;
    return 0;
}
int main()
{
    ofstream coutf;
    coutf.open("output.txt");
    ifstream cinf;
    cinf.open("input.txt");
    solve();
    cinf.close();
    coutf.close();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N; cin >> N;
    map<ll,ll> mp;
    ll ans = 0;
    REP(i,N) {
        ll a; cin>>a;
        mp[a]++;
        ans += a;
    }

    int Q; cin >> Q;
    REP(i,Q) {
        ll b, c;
        cin >> b >> c;
        ll cnt = mp[b];
        ans -= cnt * b;
        mp[b] = 0;
        mp[c] += cnt;
        ans += c * cnt;
        cout << ans << '\n';
    }

    return 0;
}

Measured memory_bytes: 9552
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            var output = 0;
            var prev = '2';
            foreach (var c in S)
            {
                if (c == prev)
                {
                    prev = c == '0' ? '1' : '0';
                    output++;
                }
                else
                {
                    prev = c;
                }
            }

            Console.Write(output);
        }
    }
}


Measured memory_bytes: 11232
#include<stdio.h>
int main(void){
  int n=0,k,inf,sum,fig,num;
  char x[1001];
  for(inf=0;inf==0;inf*=0){
    sum = 0,n = 0;
    for(k=1;k<=1001;k++){
      scanf("%c",&x[k-1]);
      if(x[k-1]=='\n') break;
      n++;
    }
    if(x[0]=='0') break;
    for(k=1;k<=n;k++){
      num = x[k-1] - 0x30; //???????????????????????§??°???????????¬??????
      /*
      if(x[k-1]==0x30) fig=0; //????????§???????????°????????????
      else if(x[k-1]=='1') fig=1;
      else if(x[k-1]=='2') fig=2;
      else if(x[k-1]=='3') fig=3;
      else if(x[k-1]=='4') fig=4;
      else if(x[k-1]=='5') fig=5;
      else if(x[k-1]=='6') fig=6;
      else if(x[k-1]=='7') fig=7;
      else if(x[k-1]=='8') fig=8;
      else if(x[k-1]=='9') fig=9;
      */
      sum += num;
    }
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;


int main(){
  long long n;
  cin >> n;
  for(long long i = n; i > 0; i--){
    long long k = pow(i, 0.5);
    if(k * k == i){
      cout << i << endl;
      break;
    }
  }

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define change(a,b) do{ll c=a; a=b; b=c;}while(0)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        change(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll N,K;
  cin>>N>>K;
  ll A[2020]={0};
  rep(i,N) cin>>A[i];
  ll ans=0;
  rep(i,N){
    rep(j,N){
      if(j<i&&A[i]>A[j])ans=(ans+K*(K-1)/2)%MOD;
      else if(j>i&&A[i]>A[j])ans=(ans+K*(K+1)/2)%MOD;
    }
  }
  cout<<ans<<endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  for (int i = 0; i < n; i++) cin >> x.at(i) >> y.at(i) >> h.at(i);
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 100; j++) {
      int h0 = -1, h0max = 2000000000;
      bool impossible = false;
      for (int k = 0; k < n; k++) {
        int h1 = h.at(k) + abs(x.at(k) - i) + abs(y.at(k) - j);
        if (h.at(k) == 0) {
          if (h0 != -1 && h0 > h1) {
            impossible = true;
            break;
          }
          h0max = h1;
        } else if (h0 == -1) {
          if (h0max < h1) {
            impossible = true;
            break;
          }
          h0 = h1;
          h0max = h1;
        } else if (h0 != h1) {
          impossible = true;
          break;
        }
      }
      if (impossible == false) {
        cout << i << " " << j << " " << h0 << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.141592653589
using namespace std;
using ll = long long;

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  string a, b;
  cin >> a >> b;
  int asize = a.size();
  int bsize = b.size();
  if(asize!=bsize){
    if(asize>bsize) cout << "GREATER" << endl;
    else cout << "LESS" << endl;
    return 0;
  }
  if(asize==bsize){
    if(a>b) cout << "GREATER" << endl;
    if(a==b) cout << "EQUAL" << endl;
    else if(a<b) cout << "LESS" << endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 3596
n=int(input())
b=list(map(int,input().split()))
a=[]
flg=1
for i in range(n):
    if flg==0:
        break
    else:
        flg=0
    for j in range(len(b)):
        #print(i,j)
        if b[len(b)-1-j]==len(b)-j:
            a.append(b[len(b)-1-j])
            b=b[:len(b)-1-j]+b[len(b)-j:]
            #print(b,a)
            flg=1
            break
if flg==0:
    print(-1)
else:
    for i in range(n):
        print(a[n-1-i])

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


int main() {
    string s;
    cin>>s;
    int n;
    n = s.length();

    int ans = 0;
    rep(i,n/2){
        if(s[i] != s[n-1-i]) ++ans;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
num = int(input())
n100 = num - 700
n10 = num - 70
n1 = num - 7
if n100  <= 99 and 0 <= n100:
  print("Yes")
elif n10 % 100 >= 0 and n10 % 100 <=9:
  print("Yes")
elif n1 % 10 == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9184
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort(ALL(c))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;

int main() {
  IN(N); IN(M);

  vector<pair<int, int>> Y;
  vector<vector<int>> sortY(N);
  REP(i, M) {
    IN(p); IN(y);
    Y.push_back(make_pair(p-1, y));
    sortY[p-1].push_back(y);
  }
  REP(i, N) {
    SORT(sortY[i]);
  }
  REP(i, M) {
    printf("%06d%06d\n", Y[i].first+1, (int)(lower_bound(ALL(sortY[Y[i].first]), Y[i].second) - sortY[Y[i].first].begin()) + 1);
  }

  return 0;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

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

  int N;
  cin >> N;

  int ans = 0;

  vector<vector<int>> suki(N);
  vector<int> a(N);

  int aa;
  rep(i, N){
    cin >> aa;
    aa--;
    a[i] = aa;
    suki[aa].push_back(i);
  }

  rep(i, N){

    for(int j = 0; j < suki[i].size(); j++){
      if(a[i] == suki[i][j]){
        ans++;
      }
    }
  }

  cout << ans / 2 << endl;
  

  return 0;
}


Measured memory_bytes: 6144
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    n,W = map(int,input().split())
    wv = [list(map(int,input().split())) for i in range(n)]
    w = [wv[i][0] for i in range(n)]
    v = [wv[i][1] for i in range(n)]
    dp = [[0]*(W+1) for i in range(n+1)]
    for i in range(W):
        dp[n][i] = 0
    for i in range(n-1,-1,-1):
        for j in range(W+1):
            if j < w[i]:
                dp[i][j] = dp[i+1][j]
            else:
                dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]]+v[i])
    print(dp[0][W])
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 125052
#include <iostream>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a==b){
		cout << c << endl;
	}else if (b==c){
		cout << a << endl;
	}else if (a==c){
		cout << b << endl;
	}
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()
    val first = s.slice(0..1).joinToString("").toInt()
    val second = s.slice(2..3).joinToString("").toInt()
    if(first in 1..12&&second in 1..12){
        println("AMBIGUOUS")
    }else if(first in 1..12){
        println("MMYY")
    }else if(second in 1..12){
        println("YYMM")
    }else{
        println("NA")
    }
}

Measured memory_bytes: 35772
#include <iostream>
using namespace std;
typedef long long ll;
int n, k, a[5050], dpmae[5050][5050], dpushiro[5050][5050], ans;
int main(void){
    // Your code here!
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    dpmae[0][0] = 1;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < k; j++){
            if (j < k - a[i]) dpmae[i][j + a[i]] += dpmae[i - 1][j];
            dpmae[i][j] += dpmae[i - 1][j];
        }
    }
    dpushiro[n + 1][0] = 1;
    for (int i = n; i >= 1; i--){
        for (int j = 0; j < k; j++){
            if (j < k - a[i]) dpushiro[i][j + a[i]] += dpushiro[i + 1][j];
            dpushiro[i][j] += dpushiro[i + 1][j];
        }
    }
    for (int i = 1; i <= n + 1; i++){
        for (int j = 1; j < k; j++){
            dpushiro[i][j] += dpushiro[i][j - 1];
        }
    }
    for (int i = 1; i <= n; i++){
        if (a[i] >= k){
            ans++;
        } else {
            bool jud = false;
            for (int j = 0; j < k; j++){
                if (dpmae[i - 1][j] * (dpushiro[i + 1][k - 1 - j] - (k - a[i] - j <= 0 ? 0 : dpushiro[i + 1][k - a[i] - 1 - j]))) jud = true;
            }
            if (jud) ans++;
        }
    }
    cout << n - ans << endl;
}


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

int main() {
	string s;
	cin >> s;
	if(s[s.size()-1]=='s'){
		s.push_back('e');
		s.push_back('s');
	}else{
		s.push_back('s');
	}
	cout << s << endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    string t;
    cin >> t;
    int a;
    int b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u == s) a--;
    else b--;
    cout << a << " " << b << endl;
	
	return 0;
	}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n;
    cin >> n;

    if(n >= 1800)cout << 1;
    else if(n >= 1600)cout <<2; 
    else if(n >= 1400)cout <<3; 
    else if(n >= 1200)cout <<4; 
    else if(n >= 1000)cout <<5; 
    else if(n >= 800)cout <<6; 
    else if(n >= 600)cout <<7;
    else cout << 8; 
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
int main(){
	
	char s[100];
	scanf("%s",s);
	int count=0;
	for(int i=0; i<strlen(s); i++){
		if(s[i]=='7'){
			count++;
		}else {
			continue;
		}
	}
	if(count>=1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1644
#include <iostream>
#include <vector>
#include <utility>
#include<string>
using namespace std;
int main(void){

    string s;
    cin>>s;
    for(size_t i=0;i<s.size();i++)
    {
        for(size_t j =0;j<s.size();j++)
        {
            if(i!=j)
            {
                if(s.at(i) ==s.at(j))
                {
                    cout<<"no"<<endl;
                    return 0;
                }
            }
        }
        
        
        
    }
    cout<<"yes"<<endl;
    //cout<<"atcoder"<<endl;
    
    return 0;
}

Measured memory_bytes: 256