akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define MAXN 200000
char s[MAXN+5];
int cnt['z'+5];
int main()
{
	scanf("%s", s);
	int len = strlen(s);
	if(len == 2)
	{
		if(s[0] == s[1]){
			puts("1 2");
			return 0;
		}
	}
	else{
		for(int i=0; i<=2; i++){
			cnt[s[i]]++;
			if(cnt[s[i]] > 1){
				puts("1 3");
				return 0;
			}
		}
		
		for(int i=3; i<len; i++)
		{
			cnt[s[i-3]]--;
			cnt[s[i]]++;
			if(cnt[s[i]] > 1)
			{
				printf("%d %d\n", i-1, i+1);
				return 0;
			}
		}
	}
	
	puts("-1 -1");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
typedef long long ll;

using namespace std;

int main()
{
	int a, b;

	cin>>a>>b;
	
	cout << max({a + b, a - b, a * b});

	return 0;
}


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

int mod = 1e9 + 7;

int main(){
    int S;
    std::cin >> S;
    
    std::vector< std::vector< long long > > A(S+1, std::vector< long long >(S / 3 + 1, 0));
    for(int i=3; i<=S; i++){
        for(int j=1; j<S/3+1; j++){
            if(j * 3 == i){
                A[i][j] = 1;
            }else{
                A[i][j] = (A[i-1][j] + A[i-3][j-1]) % mod;
            }
        }
    }
    
    long long ans = 0;
    for(int i=1; i<S/3+1; i++){
        ans = (ans + A[S][i]) % mod;
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}



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

int main(){
    int n;
    cin >> n;
    int t[n];
    string s[n], x;
    rep(i, n) cin >> s[i] >> t[i];
    cin >> x;
    int idx = 0, res = 0;

    rep(i, n) {
        if(s[i] == x) {
            idx = i;
            break;
        }
    }

    for(int i=idx+1; i<n; i++) {
        res += t[i];
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll a,b,c,d,ans;
  cin>>a>>b>>c>>d;
  ans= max(max(a*c,a*d),max(b*c,b*d));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3532
let HW = readLine()!.split(separator: " ").compactMap { Int($0) }
let h = HW[0]
let w = HW[1]

let C = readLine()!.split(separator: " ").compactMap { Int($0) }
let ch = C[0]-1
let cw = C[1]-1

let D = readLine()!.split(separator: " ").compactMap { Int($0) }
let dh = D[0]-1
let dw = D[1]-1

var shw = (1...h).map { _ in Array(readLine()!) }

var queue: [[(Int, Int)]] = Array(repeating: [], count: 1000000)
var currentResult: Int = 0
var isExist = false

func isDot(i: Int, j: Int) -> Bool {
    if i < 0 || shw.count <= i { return false }
    if j < 0 || shw[i].count <= j { return false }
    return shw[i][j] == "."
}

func search(i: Int, j: Int) {
    for idot in i-2...i+2 {
        for jdot in j-2...j+2 {
            if idot == i && jdot == j { continue }

            if isDot(i: idot, j: jdot) {
                if ((idot == i - 1 || idot == i + 1) && jdot == j) || ((jdot == j - 1 || jdot == j + 1) && idot == i) {
                    queue[currentResult].append((idot, jdot))
                } else {
                    queue[currentResult+1].append((idot, jdot))
                }
            }
        }
    }
    shw[i][j] = "#"
}

search(i: ch, j: cw)
if queue[currentResult].isEmpty {
    currentResult += 1
}
while !queue[currentResult].isEmpty {
    let element = queue[currentResult].popLast()!

    if element.0 == dh && element.1 == dw {
        isExist = true
        break
    }

    if isDot(i: element.0, j: element.1) {
        search(i: element.0, j: element.1)
    }

    if queue[currentResult].isEmpty {
        currentResult += 1
    }
}
print(isExist ? currentResult : -1)


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

const long mod = int(1e9)+7;

int main(){
  long n, k;
  cin >> n >> k;
  vector<long>a(n);
  for(int i=0; i<n; i++)cin >> a[i];
  vector<long>rtent(n), tent(n);
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(a[i]>a[j])tent[i]++;
    }
    for(int j=i; j<n; j++){
      if(a[i]>a[j])rtent[i]++;
    }
  }
  long ret=0;
  for(int i=0; i<n; i++){
    ret += ((k*(k-1)/2)%mod)*tent[i]+k*rtent[i];
    ret %= mod;
  }
  cout << ret;
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const int N = 2e3 + 1;
int n;
long long int dp[N];
long long int calc(int value){
  if(value == n)return 1;
  if(value > n)return 0;
  long long int &ret = dp[value];
  if(ret != -1)return ret;
  ret = 0;
  for(int i = 3; i <= n; i++){
    ret += calc(value + i) % mod;
    ret %= mod;
  }
  return ret;
}
int main(){ 
  cin >> n;
  memset(dp, -1, sizeof dp);
  cout << calc(0);

  return 0;
}

Measured memory_bytes: 3664
i,v,s[5000],m,*p;main(n){for(;~scanf("%d",&n);n&&printf("%d\n",m))for(memset(s,i=0,n*4),m=-1e5;i++<n;)for(scanf("%d",&v),p=s+i;p---s;m=*p>m?*p:m)*p+=v;}

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	string current = { s[0] };
	long long ans = n;
	for (int i = 1; i < n; i++) {
		if (current.size() == 1 && current[0] == s[i]) {
			ans--;
			current = { s[i],s[i + 1] };
			i++;

		}
		else {
			current = { s[i] };
		}

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

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

int N;
int main(){
    cin >> N;
    int x = 0;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        x ^= a;
    }
    cout << (x==0? "Yes":"No") << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll x, y;
    cin >> x >> y;
    ll s = abs(abs(x) - abs(y));
    //! 反転ボタンを押す数を決める
    if (y < x && (x < 0 || y > 0))
        s += 2;
    else if (y < x && 0 <= x)
        s++;
    else if (x < y && y > 0 && x < 0)
        s++;
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
void main() {
	auto N = rs;
	auto K = ri;
	
	while(N.length < 100) N = '0' ~ N;
	auto S = '0'.repeat(100).array;

	ulong res;
	foreach(i; 0..100) {
		for(S[i] = '1'; S[i] <= '9'; S[i]++) {
			if(K == 1 && S <= N) res++;
			foreach(j; 0..i) {
				for(S[j] = '1'; S[j] <= '9'; S[j]++) {
					if(K == 2 && S <= N) res++;
					foreach(k; 0..j) {
						for(S[k] = '1'; S[k] <= '9'; S[k]++) {
							if(K == 3 && S <= N) res++;
						}
						S[k] = '0';
					}
				}
				S[j] = '0';
			}
		}
		S[i] = '0';
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

#define pb push_back
#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 1e5 + 10;

int n, m;

int delt[N], A[N];
vector<int> del[N];

typedef long long LL;

int main(){

	scanf("%d%d", &n, &m);

	LL origin = 0;
	For(i, 1, n) scanf("%d", &A[i]);
	For(i, 2, n) origin += (A[i] - A[i - 1] + m) % m;

	int tot = 0;
	LL sum = 0;

	For(i, 2, n) if((A[i] - A[i - 1] + m) % m > 1){
		int l = A[i - 1] % m + 1, r = A[i];

		delt[l]++;
		if(l <= r) del[r].pb(l);
		else{
			del[r].pb(l - m);
			++tot, sum += l - m;
		}
	}

	LL mx = 0;
	For(i, 1, m){
		tot += delt[i], sum += 1ll * delt[i] * i;
		mx = max(mx, 1ll * tot * i - sum);
		for(int l : del[i]) --tot, sum -= l;
	}
	printf("%lld\n", origin - mx);

	return 0;
}

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

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  string ans;
  for(int i = 0; i < n; i++){
    ans += s[i];
    ans += t[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    # N以下の素数列挙
    def make_prime_nums(n):
        prime_nums = [2 if n >= 2 else None]
        for i in range(3, n + 1):
            for p in prime_nums:
                if p >= int(i ** (1 / 2)) + 1:
                    prime_nums.append(i)
                    break
                if i % p == 0:
                    break
        return prime_nums

    n = ni()
    p = make_prime_nums(2000)

    ans = []
    for pi in p:
        if pi % 10 == 1:
            ans.append(pi)
        if len(ans) == n:
            break

    print(*ans, sep=" ")



if __name__ == '__main__':
    main()


Measured memory_bytes: 9564
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> vs;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    int sx = 0, sy = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (vs[i][j] == 'S') {
                sx = i, sy = j;
                vs[i][j] = '.';
                break;
            }
        }
    }
    vector<vector<int>> visited(h, vector<int>(w, 0));
    vector<pair<int, int>> vp1, vp2;
    vp1.push_back(make_pair(sx, sy));
    visited[sx][sy] = 1;
    vector<vector<int>> dir{{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
    int res = 0;
    bool first_time = true;
    while (vp1.size() > 0) {
        vector<pair<int, int>> vp;
        for (int i = 0; i < k; i++) {
            vp2.clear();
            for (auto node : vp1) {
                for (auto d : dir) {
                    int x = node.first + d[0], y = node.second + d[1];
                    if (x < 0 || y < 0 || x >= h || y >= w || visited[x][y] == 1) continue;
                    if (first_time && vs[x][y] == '#') continue;
                    visited[x][y] = 1;
                    vp2.push_back(make_pair(x, y));
                    vp.emplace_back(x, y);
                }
            }
            vp1 = vp2;
        }
        vp1 = vp;
        if (first_time) vp1.push_back(make_pair(sx, sy));
        first_time = false;
        res++;
        for (auto node : vp1) {
            if (node.first == 0 || node.first == h - 1 || node.second == 0 || node.second == w - 1) {
                cout << res << endl;
                return 0;
            }
        }
    }
}




Measured memory_bytes: 21392
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N=sc.nextInt();
		int i,sum=0;
		for(i=8;i>=0;i--) {
			sum+=(N%Math.pow(10,i+1))/Math.pow(10,i);
		}
		if(N%sum==0)System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 22100
N = int(input())
mid = (N-1)//2

print(mid)
s = input()
if s == "Vacant":
    exit()
else:
    mid_state = s

print(0)
s = input()
if s == "Vacant":
    exit()
elif (mid % 2 == 0 and mid_state != s) or (mid % 2 != 0 and mid_state == s):
    l, r, l_state = 0, mid, s
else:
    l, r, l_state = mid, N, mid_state

while True:
    if (r - l) % 2 != 0:
        i = (r-l+1)//2 + l
    else:
        i = (r-l)//2 + l
    print(i)
    s = input()
    if s == "Vacant":
        exit()
    elif ((i-l) % 2 == 0 and l_state != s) or ((i-l) % 2 != 0 and l_state == s):
        r = i
    else:
        l, l_state = i, s


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>

using pii   = std::pair<int, int>;
using State = std::tuple<int, int, int, int>;

constexpr int MAXT = 40;
constexpr int INF  = (1 << 29);

int main()
{
    int W, H, N, sx, sy;
    std::cin >> W >> H >> N >> sx >> sy;
    sx--; sy--;
    
    std::vector<std::vector<pii>> paths(N);
    std::vector<std::vector<bool>> pass(H, std::vector<bool>(W, true));
    
    int closed = 0;
    for (int i = 0; i < N; i++) {
        int L;
        std::cin >> L;
        
        std::vector<pii> path(L);        
        for (int j = 0; j < L; j++) {
            int x, y;
            std::cin >> x >> y;
            x--; y--;
            path[j] = {x, y};
            
            if (j == 0 && x == sx && y == sy) {
                closed |= 1 << i;
            }

            if (j == L - 1) {
                pass[y][x] = false;
            }
        }

        paths[i] = path;
    }
    
    
    int d[H][W][1 << N][MAXT];
    std::fill(d[0][0][0], d[0][0][0] + H * W * (1 << N) * MAXT, INF);
    
    d[sy][sx][closed][0] = 0;
    
    std::queue<State> Q;
    Q.push(State(sx, sy, closed, 0));

    constexpr int dx[] = {-1, -1, -1, +0, +0, +0, +1, +1, +1};
    constexpr int dy[] = {-1, +0, +1, -1, +0, +1, -1, +0, +1};
    
    int ret = -1;
    while (!Q.empty()) {
        int x, y, S, t;
        std::tie(x, y, S, t) = Q.front(); Q.pop();

        auto is_timeup = [&]() -> bool {
            for (int i = 0; i < N; i++) {
                if (!(S >> i & 1) && (int)paths[i].size() <= t) {
                    return true;
                }               
            }
            return false;
        };
        
        if (is_timeup()) {
            continue;
        }
        
        if (S == (1 << N) - 1) {
            ret = t;
            break;
        }

        for (int i = 0; i < 9; i++) {
            int nx = x + dx[i], ny = y + dy[i]; // robot's next position
            if (nx < 0 || nx >= W || ny < 0 || ny >= H || !pass[ny][nx]) {
                continue;
            }
            
            int nS = S;
            for (int j = 0; j < N; j++) {
                if ((int)paths[j].size() <= t + 1) { continue; }
                
                int fx, fy; // fire's next position
                std::tie(fx, fy) = paths[j][t + 1];
                
                if (fx == nx && fy == ny) {
                    nS |= 1 << j;
                }
            }

            if (t + 1 < d[ny][nx][nS][t + 1]) {
                d[ny][nx][nS][t + 1] = t + 1;
                Q.push(State(nx, ny, nS, t + 1));
            }
        }
    }

    std::cout << ret << std::endl;
    
    return 0;
}

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

using namespace std;
int N,C;
typedef long long ll;
const ll mod = 1e9 + 7;

ll memo[401][401];
ll dp[401][401];
int A[401],B[401];

int main() {
  cin >> N >> C;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++) cin >> B[i];
  
  for(int i = 0; i < N; i++) {
    for(int j = A[i]; j <= B[i]; j++) {
      ll p = 1;
      for(int k = 0; k <= C; k++) {
	memo[i][k] += p;
	p *= j;
	p %= mod;
	memo[i][k] %= mod;
      }
    }
  }

  dp[0][0] = 1;

  for(int i = 1; i <= N; i++) {
    for(int j = 0; j <= C; j++) {
      for(int k = 0; k <= j; k++) {
	dp[i][j] += dp[i-1][j-k] * memo[i-1][k];
	dp[i][j] %= mod;
      }
    }
  }
  cout << dp[N][C] <<endl;
}
  
      
      
  


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

using namespace std;

typedef long long ll;

const ll N = (ll) 2e5 + 7;

ll n;
map <ll, ll> normal;
ll cur_normal = 0;

struct Question {
        ll type;
        ll a, b;
        ll i;
};

Question q[N];



ll t_sum[N]; /// <--- Fenwick Tree for sum
ll value[N];

ll prefix_sum(ll p) {
        ll r = 0LL;
        for (ll i = p; i >= 1; i -= i & (-i)) {
                r += t_sum[i];
        }
        return r;
}

void add_sum(ll p, ll x) {
        for (ll i = p; i < N; i += i & (-i)) {
                t_sum[i] += x;
        }
}

ll t_cnt[N]; /// <--- Fenwick Tree for cnt

ll prefix_cnt(ll p) {
        ll r = 0;
        for (ll i = p; i >= 1; i -= i & (-i)) {
                r += t_cnt[i];
        }
        return r;
}

void add_cnt(ll p, ll x) {
        for (ll i = p; i < N; i += i & (-i)) {
                t_cnt[i] += x;
        }
}

ll find_k(ll k) {
        ll r = 0, pas = (1 << 17);
        ll kolbar = 0LL;
        while (pas > 0) {
                if (r + pas < N && t_cnt[r + pas] + kolbar < k) {
                        r += pas;
                        kolbar += t_cnt[r];
                }
                pas >>= 1;
        }
        r++;
        return r;
}

/// Operators for Question :

bool cmp1(Question x, Question y) {
        return x.a < y.a;
}

bool cmp2(Question x, Question y) {
        return x.i < y.i;
}

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

        cin >> n;
        for (ll i = 1; i <= n; i++) {
                cin >> q[i].type;
                if (q[i].type == 1) {
                        cin >> q[i].a >> q[i].b;
                }
                q[i].i = i;
        }

        sort(q + 1, q + n + 1, cmp1);

        for (ll i = 1; i <= n; i++) {
                if (q[i].type == 1) {
                        if (normal[q[i].a] == 0) {
                                cur_normal++;
                                normal[q[i].a] = cur_normal;
                                value[cur_normal] = q[i].a;
                        }
                }
        }

        sort(q + 1, q + n + 1, cmp2);

        ll bSum = 0LL, aSum = 0LL;
        ll cate = 0;

        for (ll i = 1; i <= n; i++) {
                if (q[i].type == 1) {
                        bSum += q[i].b;
                        aSum += q[i].a;
                        ll x = normal[q[i].a];
                        add_cnt(x, 1);
                        add_sum(x, value[x]);
                        cate++;
                } else {
                        ll poz = find_k((cate + 1) / 2);
                        ll FirstHalf = (cate + 1) / 2, SecondHalf = cate - FirstHalf;
                        ll SumFirstHalf = prefix_sum(poz - 1) + (FirstHalf - prefix_cnt(poz - 1)) * value[poz], SumSecondHalf = aSum - SumFirstHalf;
                        ll total = bSum + (FirstHalf * value[poz] - SumFirstHalf) + (SumSecondHalf - value[poz] * SecondHalf);

                        cout << value[poz] << " " << total << "\n";
                }
        }

}


Measured memory_bytes: 19072
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------
 
signed main() {
    string s;
    cin>>s;
    if(s[0]=='9' || s[1]=='9') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
  string a, b;
  cin >> a >> b;
  
  int p = 0;
  for(int i = 0; i < 3; i++){
    if(a.at(i) == b.at(2 - i)){
      p++;
    }
  }
  if(p == 3) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>

int main(int argc, char* pArgv[])
{
  int n = 0;
  std::string s;

  std::cin >> n;
  std::unordered_set<int> m;
  for (int index = 0; index < n; index ++) {
    int a = 0;
    std::cin >> a;
    if (m.find(a) == m.cend()) {
      m.insert(a);
    }
  }
  std::cerr << "m.size()=" << m.size() << ", " <<
      "n=" << n << std::endl;
  bool result = (m.size() == n);

  std::cout << (result ? "YES" : "NO") << std::endl;
  return 0;
}



Measured memory_bytes: 8520
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>n>>y;
    rep(i,n){
        cin>>a[i];
        a[i]=abs(a[i]-y);
    }
    ans=a[0];
    rrep(i,1,n){
        ans=__gcd(ans,a[i]);
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

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

  cout << (a + b) % 24 << '\n';

  return 0;
}


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

int main()
{
    int W,H;
    int x,y,r;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    W -= r,H -= r;
    if (r <= x && x <= W && r <= y && y <= H) printf("Yes\n");
    else printf("No\n");
    return 0;
    
}



Measured memory_bytes: 2120
fun main(args: Array<String>) {
    val (n, t) = readLine()!!.split(" ").map { it.toInt() }
    val inputs = readLine()!!.split(" ").map { it.toInt() }

    var sum = 0L

    var now = inputs[0]
    for (i in 1..n-1) {
        if( inputs[i] - now >= t) {
            sum += t
            now = inputs[i]
        } else {
            sum += inputs[i] - now
            now = inputs[i]
        }
    }
    sum += t

    println(sum)
}

Measured memory_bytes: 81104
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
struct sta {
  long long s, t, a;
  sta(long long s, long long t, long long a) : s(s), t(t), a(a) {}
  const bool operator<(const sta& x) {
    return s > x.s;
  }
};
 
int main() {
  int n; cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<sta> v;
  for (int i = 0; i < n; i++) v.push_back(sta(a[i] + b[i], a[i], b[i]));
  sort(v.begin(), v.end());
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (i % 2 ? -v[i].a : v[i].t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6260
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int cnt = 0;

    for (int i = A; i <= B; i++) {
      cnt = isPalindromic(i) ? cnt + 1 : cnt;
    }

    System.out.println(cnt);
  }

  static boolean isPalindromic(int num) {
    char[] arr = String.valueOf(num).toCharArray();
    for (int i = 0; i < arr.length / 2; i++) {
      if (arr[i] != arr[arr.length - 1 - i])
        return false;
    }
    return true;
  }

}


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  string S,T;
  cin >> S;
  cin >> T;
  int ans = 0;
  for(int i = 0; i < S.size(); i++){
    if(S[i] != T[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3920
#include<iostream>
using namespace std;
int main()
{
	int a,g,b;
	cin>>a;
	b=a/100;
	g=a%10;
	if(b==g)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b, c, d; cin >> a >> b >> c >> d;
    int tmp;
    tmp = max(abs(b-a), abs(c-b));
    tmp = min(tmp, abs(c-a));
    cout << (tmp<=d ? "Yes":"No") << endl;
    
    return 0;
}

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

int main()
{
    int n;
    string str;
    char a[7][3] = {{'a','b','c'},{'d','e','f'},{'g','h','i'},
                     {'j','k','l'},{'m','n','o'},{},{'t','u','v'}};
    char b[3][4] = {{'p','q','r','s'},{},{'w','x','y','z'}};
    char c[5] = {'.',',','!','?',' '};

    cin >> n;

    while( n-- )
    {
        cin >> str;

        int j = 0;
        char d;
        for( int i = 0; i < str.size(); i++ )
        {
            if( str[i] == '0' )
            {
                if( i - 1 >= 0 && str[i-1] != '0' )
                    cout << d;
                j = 0;
            }
            else if( str[i] == '1' )
            {
                d = c[j];
                j++;
                j %= 5;
            }
            else if( str[i] == '7' || str[i] == '9' )
            {
                d = b[str[i]-'0'-7][j];
                j++;
                j %= 4;
            }
            else
            {
                d = a[str[i]-'0'-2][j];
                j++;
                j %= 3;
            }
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3232
# bit演算という方法がある、ビット演算子
# a & b 1,1で1
# a | b 1,1, 1,0, 0,1で1
# a ^ b xor
# ~a ビット反転
# << 左シフト
# >> 右シフト
# 未知のxkを既知のkkに置き換える
# k += 1 として、x < k を満たす
# この時、xの未知の40桁のいくつかを、既知のkで置き換える
# 注意として、xはkより大きくなってはいけない

n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

ck = [0 for i in range(40)]
for i in a:
    for j in range(40):
        if i>>j & 1:
            ck[j] += 1

fx = []
for i in range(40):

    if (k+1)>>i & 1 == 0:
        continue

    ans = 0
    for j in range(40):
        if j > i:
            if ((k+1)>>j) & 1:
                ans += (1<<j) * (n-ck[j])
            else:
                ans += (1<<j) * ck[j]
        elif j == i:
            ans += (1<<j) * ck[j]
        else:
            if ck[j] * 2 > n:
                ans += (1<<j) * ck[j]
            else:
                ans += (1<<j) * (n-ck[j])

    fx.append(ans)

print(max(fx))


Measured memory_bytes: 14708
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
#include <random>
using namespace std;
typedef long long ll;

int main()
{
	string s;
	cin >> s;
	ll sum = 0;
	for (auto c : s)sum += c - '0';
	if (sum % 9 == 0)cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 3708
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
   int n,m,X,Y;
   cin>>n>>m>>X>>Y;
   int a=X,b=Y,c=X,d=Y;
   rep(i,0,n){
      int x;
      cin>>x;
      if (X>Y){
         if (a>x) a=x;
      }
      else {
         if (c<x) c=x;
      }
   }
   rep(j,0,m){
      int y;
      cin>>y;
      if (X>Y){
         if (b<y) b=y;
      }
      else {
         if (d>y) d=y;
      }
   }
   if ((a>b)|(c<d)) cout<<"No War";
   else cout<<"War";
}

Measured memory_bytes: 256
#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)

int main() {
 int n,m=1; cin >> n;
 vector<int> x(n),y(n);
  rep(i,n){
    cin >> x[i] >> y[i];
    m*=(i+1);//n!を求める
  }
  double dsum=0;
  rep(i,n){
    for(int j=i+1;j<n;j++){
      double a=sqrt(pow(abs(x[i]-x[j]),2)+pow(abs(y[i]-y[j]),2));
      dsum +=a;
    }
  }

  int b=2*m/n;
  cout << setprecision(10) << (b*dsum)/m << endl;
}


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

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class DBannedK {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll N; in >> N;
	    vector<ll> count(N);
	    ll A[N];
	    REP(i, N) {
	        in >> A[i]; A[i]--;
	        count[A[i]]++;
	    }
	    ll _max = 0;
	    REP(i, N) {
	        _max += (count[i]) * (count[i] - 1) / 2;
	    }
	    REP(i, N) {
	        ll dis = count[A[i]] == 0 ? 0 : count[A[i]] - 1;
            out << _max - dis << '\n';
	    }
	}
};


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

	DBannedK solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cassert>
#define ll long long
using namespace std;
inline ll read(){
	ll re=0,flag=1;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
ll n;ll m=200000;
struct BIT{
	ll a[200010];
	void clear(){
		memset(a,0,sizeof(a));
	}
	ll lowbit(ll x){
		return x&(-x);
	}
	void add(ll x,ll val){
		for(;x<=m;x+=lowbit(x)) a[x]+=val;
	}
	ll sum(ll x){
		ll re=0;
//		cout<<"getsum "<<x<<' ';
		for(;x>0;x-=lowbit(x)) re+=a[x];
		//cout<<re<<'\n';
		return re;
	}
}T;
struct ele{
	ll val,num;
}a[100010];ll w[100010];
bool cmp1(ele l,ele r){
	return l.val<r.val;
}
bool cmp2(ele l,ele r){
	return l.num<r.num;
}
ll x[100010];ll lim;
bool check(ll val){
	ll i;ll sum=0,re=0;T.clear();
	for(i=1;i<=n;i++){
		if(a[i].val<val) x[i]=-1;
		else x[i]=1;
	}
	T.add(100000,1);
	for(i=1;i<=n;i++){
		sum+=x[i];
		re+=T.sum(sum+100000);
		T.add(sum+100000,1);
	}
//	cout<<"check "<<val<<' '<<re<<'\n';
	return re>=(lim/2+lim%2);
}
int main(){
	ll i;
	n=read();lim=n*(n+1)/2;
	for(i=1;i<=n;i++) a[i].val=read(),a[i].num=i;
	sort(a+1,a+n+1,cmp1);
	for(i=1;i<=n;i++) w[i]=a[i].val;
	sort(a+1,a+n+1,cmp2);
	ll l=1,r=n,mid;
	while(l<r){
		mid=(l+r)>>1;mid++;
		if(check(w[mid])) l=mid;
		else r=mid-1;
	}
	printf("%lld\n",w[l]);
} 
/*
10
5 9 5 9 8 9 3 5 4 3

*/


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var d = input[0];
            var n = input[1];
            if (n >= 100) {
                n = 101;
            }

            var ans = Math.Pow(100, d) * n;

            Console.WriteLine(ans);
        }
    }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    for(i = 0;i < 1e5;++i){
        if(i*108/100 == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 3644
// template {{{

#include <bits/stdc++.h>
using namespace std;

#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) loop(i, 0, n)
#define rloop(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define rrep(i, n) rloop(i, 0, n)
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second

using ll = long long;
using ull = unsigned long long;

template<typename T, size_t H, size_t W>
using matrix = std::array<std::array<T, W>, H>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;

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

template<typename T>
inline T sq(T x){ return x * x; }

template<typename T, typename U>
inline void chmax(T &x, U y){ x = std::max<T>(x, y); }

template<typename T, typename U>
inline void chmin(T &x, U y){ x = std::min<T>(x, y); }

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(c); c.erase(std::unique(std::begin(c), std::end(c))); }

// }}}

int n;
int a[100000];
int b[100000];

int main()
{
	cin >> n;
	rep(i, n) cin >> a[i];
	
	int t = 0;
	rep(i, n){
		if (a[i] < 0) chmin(t, -a[i]);
		else if (a[i] == 0) t = INF;
		chmax(b[i], t);
		t--;
	}
	t = 0;
	rrep(i, n){
		if (a[i] < 0) chmin(t, -a[i]);
		else if (a[i] == 0) t = INF;
		chmax(b[i], t);
		t--;
	}

	int res = 0;
	rep(i, n){
		if (a[i] > 0) res += min(a[i], b[i]);
	}
	
	cout << res << endl;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc157/abc157_d.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const int MOD = 1e9 + 7;

struct UnionFind {
  vector<int> par;  // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N) {  //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++) par[i] = i;
  }

  int root(int x) {  // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  vector<int> cnt;
  void countUp() {
    cnt = vector<int>(par.size(), 0);
    for (int i = 0; i < par.size(); i++) {
      int r = root(i);
      cnt[r]++;
    }
  }
  int countConnected(int x) { return cnt[root(x)]; }

  void unite(int x, int y) {  // xとyの木を併合
    int rx = root(x);         // xの根をrx
    int ry = root(y);         // yの根をry
    if (rx == ry) return;  // xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] =
        ry;  // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y) {  // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M, K;
  cin >> N >> M >> K;

  UnionFind u = UnionFind(N);
  vector<vector<int>> fr(N, vector<int>(0));
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    fr[a].push_back(b);
    fr[b].push_back(a);
    u.unite(a, b);
  }

  vector<vector<int>> bl(N, vector<int>(0));
  rep(i, K) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (u.same(a, b)) {
      bl[a].push_back(b);
      bl[b].push_back(a);
    }
  }

  u.countUp();

  rep(i, N) {
    int ans = u.countConnected(i) - fr[i].size() - bl[i].size() - 1;
    cout << ans << ' ';
  }
}

Measured memory_bytes: 13048
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

struct TParitalSums {
  vector<vi> s;
  TParitalSums(const vector<vi>& a) {
    s = a;
    for (int i = 0; i < a.size(); ++i) for (int j = 0; j < a[0].size(); ++j) {
      s[i][j] = a[i][j];
      if (i > 0) s[i][j] += s[i - 1][j];
      if (j > 0) s[i][j] += s[i][j - 1];
      if (i > 0 && j > 0) s[i][j] -= s[i - 1][j - 1];
    }
  }

  int Get(int x1, int y1, int x2, int y2) {
    if (x1 > x2) return 0;
    if (y1 > y2) return 0;
    int result = s[x2][y2];
    if (x1 > 0) result -= s[x1 - 1][y2];
    if (y1 > 0) result -= s[x2][y1 - 1];
    if (x1 > 0 && y1 > 0) result += s[x1 - 1][y1 - 1];
    return result;
  }
};

int main()
{
  int n, m, q;
  cin >> n >> m >> q;
  vector<string> s(n); for (int i = 0; i < n; ++i) cin >> s[i];
  vector<vi> a(n, vi(m));
  auto b = a;
  auto c = a;
  for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) {
    a[i][j] = s[i][j] -'0';
    if (i > 0 && a[i - 1][j] && a[i][j]) b[i][j] = 1;
    if (j > 0 && a[i][j - 1] && a[i][j]) c[i][j] = 1;
  }
  TParitalSums A(a), B(b), C(c);
  for (int i = 0; i < q; ++i) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--, y1--, x2--, y2--;
    cout << A.Get(x1, y1, x2, y2) - B.Get(x1 + 1, y1, x2, y2) - C.Get(x1, y1 + 1, x2, y2) << endl;
  }
  return 0;
}


Measured memory_bytes: 100096
#include <iostream>
using namespace std;
int main(void){
    
    int K;
    cin >> K;
    
    int ans = 0;
    for(int i = 1; i <= K; i+=2){
        for(int j = 2; j <= K; j+=2){
            ans++;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3144
// Header {{{
#include <bits/stdc++.h>

using namespace std;
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;
typedef unsigned long long int ull;
typedef long long int ll;
#define rep(i,a,b) for (ll i=(a); i<(b); i++)
typedef pair<ll,ll> PLL;
// }}}

ll maxll(ll x, ll y){
    return x>y ? x : y;
}

signed main() {
    ll a,b,c,ans=0;
    cin>>a>>b>>c;
    ll t = (a&1)+(b&1)+(c&1);
    if (t==0){
        // even, even, even
    } else if (t==1){
        // even, even, odd
        ans+=1;
        a|=1; b|=1; c|=1;
    } else if (t==2){
        // even, odd, odd
        ans+=1;
        if (a&1 == 1) a++;
        if (b&1 == 1) b++;
        if (c&1 == 1) c++;
    }else{
        // odd, odd, odd
    }
    ll m = max(a,max(b,c));
    ans += (m-a)/2;
    ans += (m-b)/2;
    ans += (m-c)/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
import collections

N = int(input())
V = np.array(list(map(int, input().split())))

if N == len(np.where(V == V[0])[0]):
    print(N // 2)
else:
    v0 = [V[i] for i in range(0, N - 1, 2)]
    v1 = [V[i] for i in range(1, N, 2)]
    v0_items = dict(collections.Counter(v0).items())
    v1_items = dict(collections.Counter(v1).items())
    v0_max_key = max(v0_items, key=v0_items.get)
    v1_max_key = max(v1_items, key=v1_items.get)
    
    if v0_max_key == v1_max_key:
        count = v0_items.pop(v0_max_key)
        count = (N // 2) - v1_items.pop(v1_max_key)
        tmp1 = v0_items.pop(max(v0_items, key=v0_items.get))
        tmp2 = v1_items.pop(max(v1_items, key=v1_items.get))
        count += (N // 2) - max(tmp1, tmp2)
        print(count)
    else:
        count = (N // 2) - max(collections.Counter(v0).values())
        count += (N // 2) - max(collections.Counter(v1).values())
        print(count)

Measured memory_bytes: 29316
#include <bits/stdc++.h>
#define greeting cerr << "R U OK?"

using namespace std;

map<string, int> f;

// #define local
int main()
{
#ifdef local
    freopen("data.in", "r", stdin);
    freopen("ans.out", "w", stdout);
#endif
    f["SUN"] = 0;
    f["MON"] = 1;
    f["TUE"] = 2;
    f["WED"] = 3;
    f["THU"] = 4;
    f["FRI"] = 5;
    f["SAT"] = 6;
    string s;
    cin >> s;
    printf("%d\n", 7-f[s]);
    return 0;
}


Measured memory_bytes: 256
N,C = map(int,input().split())
stc = [[int(x) for x in input().split()] for _ in [0]*N]
st = []
for c in range(1,C+1):
    stlist = sorted([x for x in stc if x[2]==c])
    prevs = prevt = 0
    for s,t,c in stlist:
        if s != prevt:
            st.append((prevs,prevt))
            prevs = s
        prevt = t
    st.append((prevs,prevt))
st = sorted([x for x in st if x!=(0,0)])
rec = [0]
for _st in st:
    m= min(rec)
    if m<_st[0]:
        rec.remove(m)
    rec.append(_st[1])
print(len(rec))

Measured memory_bytes: 30780
def main():
    N, T = map(int, input().split())
    min_c = 1001
    min_t = 1001

    for _ in range(N):
        c, t = map(int, input().split())
        if c < min_c and t <= T:
            min_c = c
            min_t = t
    if min_c > 1000:
        print("TLE")
    else:
        print(min_c)

if __name__=='__main__':
    main()

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int):
    print(YES if N == M else NO)
    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()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


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

class Cube {
   public:
    int f[6];  //サイコロ
    Cube() {}  //コンストラクタ
    void roll_z() { roll(1, 2, 4, 3); }
    void roll_y() { roll(0, 2, 5, 3); }  // to W
    void roll_x() { roll(0, 1, 5, 4); }  // to N
    void roll(int i, int j, int k, int l) {
        int t = f[i];
        f[i]  = f[j];
        f[j]  = f[k];
        f[k]  = f[l];
        f[l]  = t;
    }
    void move(char ch) {
        if (ch == 'E')
            for (int i = 0; i < 3; i++) roll_y();  // Wを３回
        if (ch == 'W') roll_y();
        if (ch == 'N') roll_x();
        if (ch == 'S')
            for (int i = 0; i < 3; i++) roll_x();  // Nを３回
    }
};

int main() {
    Cube   c;    // サイコロ
    string com;  // 命令

    // 入力
    for (int i = 0; i < 6; i++) cin >> c.f[i];  // サイコロの面
    cin >> com;                                 // 命令

    // 処理
    for (int i = 0; i < com.size(); i++) {
        c.move(com[i]);
    }

    // 出力
    cout << c.f[0] << "\n";

    return 0;
}



Measured memory_bytes: 3200