akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007
INF = float("inf")

def main():
    N, K = LI()
    A = LI()
    S = list(itertools.accumulate(A))
    keep = defaultdict(int)
    keep[0] += 1
    ans = 0

    for i in range(1, N+1):
        v = (S[i-1] - i) % K
        if i == K:
            keep[0] -= 1
        if i - K > 0:
            w = (S[i-K-1] - (i - K)) % K
            keep[w] -= 1
        ans += keep[v]
        keep[v] += 1
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 142052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;

int n,m;
ll d[105][105];
bool v[105][105];

int main() {
	cin>>n>>m;
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
		if (i==j) {
			d[i][j]=0;
			v[i][j]=1;
		}
		else d[i][j]=INF;	
	}
	for (int i=0;i<m;i++) {
		int s,t,l; cin>>s>>t>>l;
		d[s][t]=l;
		v[s][t]=1;
	}
	for (int k=0;k<n;k++)
	  for (int i=0;i<n;i++)
	  for (int j=0;j<n;j++)
	    	d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	for (int i=0;i<n;i++) 
		if (d[i][i]<0) {
			cout<<"NEGATIVE CYCLE"<<'\n';
			return 0;
		}
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
		if (d[i][j]>INF/2) cout<<"INF";
		else cout<<d[i][j];
		cout<<" \n"[j+1==n];
	}
}



Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define INF 1000000000000000000
using namespace std;

int main(){
  long long A,B,C,K,a,b,c;
  cin >> A >> B >> C >> K;
  if(K%2==0){
    cout << A-B << endl;
  }else{
    cout << B-A << endl;
  }
  return 0;
}


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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append([i, n//i])
    # divisors.sort()
    return divisors

div_lst = make_divisors(N)

min_num = float("inf")
for d in div_lst:
    tmp = d[0]+d[1]
    if tmp < min_num:
        min_num = tmp

print(min_num-2)


Measured memory_bytes: 3560
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int a[] = new int[N];
        for(int i = 0; i < N; i++){
            a[i] = sc.nextInt();
        }
        
       
      
        for(int j = 1; a.length > j; j++){           
            int  s = a[j];
            int i = j - 1;

            for(int e = 0; a.length > e; e++){           
            System.out.print(a[e]);
            
            if(a.length - 1 > e){
            System.out.print(" ");
            }
            if(a.length - 1 == e){
                System.out.println();
            }
            }

           
            
            while(i >= 0 && a[i] > s){
                a[i + 1] = a[i];
                i--;
                a[i + 1] = s;
            }
        }
    
        for(int e = 0; a.length > e; e++){
           
            System.out.print(a[e]);
            
            if(a.length - 1 > e){
            System.out.print(" ");
            }
            if(a.length - 1 == e){
                System.out.println();
            }
            }

      
    }
}


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

long long int culc(long long int x){
  long long int tmp=0;
  for(int i=0;i<=x-1; i++){
    tmp += pow(10,i);
    //cout << tmp << endl;
  }
  tmp *=7;
  return tmp;
}

int main() {
  long long int K;
  long long int N = 1000001;
  cin >> K;
  int count=-1;
  long long int a=7;
  vector<int> b(N);

  for(long long int i=0;i<N;i++){
    if(a%K==0){
      count = i+1;
      break;
    }
    long long int tmp;
    tmp = a%K;

    if(b.at(tmp-1)!=1){
      b.at(tmp-1)=1;
    }
    else{
      break;
    }

    a=tmp*10+7;
    if(i>K){
      break;
    }

  }
  cout << count << endl;
}


Measured memory_bytes: 7280
#include<iostream>
#include<queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  for ( int i = 0; i < n; i++ ) d[i] = INFTY;
  d[s] = 0;
  int u;
  while ( !q.empty() ) {
    u = q.front(); q.pop();
    for ( int v = 0; v < n; v++ ) {
      if ( M[u][v] == 0 ) continue;
      if ( d[v] != INFTY ) continue;
      d[v] = d[u] + 1;
      q.push(v);
    }
  }
  for ( int i = 0; i < n; i++ ) {
    cout << i + 1 << " " << ( ( d[i] == INFTY ) ? ( -1 ) : d[i] ) << endl;
  }
}

int main() {
  int u, k, v;

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

  for ( int i = 0; i < n; i++ ) {
    cin >> u >> k;
    u--;
    for ( int j = 0; j < k; j++ ) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  bfs(0);

  return 0;
}
  


Measured memory_bytes: 3116
def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if n // i != i:
                divisor.append(n // i)
    # divisor.sort() # if you want sorted divisors
    return divisor


x = int(input())
cand = get_divisor(x)
# print(cand)
for d in cand:
    if d**5 == x:
        print(d, 0)
    elif d**5 < x:
        a = d
        b = 0
        while a**5 - b**5 < x:
            a += 1
            b += 1
        if a**5 - b**5 == x:
            print(a, b)
            break

        a = 0
        b = -d
        while a**5 - b**5 < x:
            a -= 1
            b -= 1
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        if d % 2 == 0 and (d // 2)**5 + (d // 2)**5 > x:
            continue
        if d % 2 == 1 and ((d + 1) // 2)**5 + (d // 2)**5 > x:
            continue
        a = d
        b = 0
        while a**5 - b**5 > x:
            a -= 1
            b -= 1
            # print(a, b, a**5 - b**5)
        if a**5 - b**5 == x:
            print(a, b)
            break

        a = 0
        b = -d
        while a**5 - b**5 > x:
            a += 1
            b += 1
        if a**5 - b**5 == x:
            print(a, b)
            break


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

int main() {
  int N,A;
  int r;
  cin >> N >> A;
  
  r = N % 500;

  if(r <= A){    
  	cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

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

inline long lcm(long a, long b) {
    long t = a / gcd(a, b);
    return t * b;
}

int main() {
    long n;
    cin >> n;
    long ans = 1;
    for (int i = 0; i < n; i++) {
        long t;
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  string n;
  cin >> n;
  replace(all(n), '1', '0');
  replace(all(n), '9', '1');
  replace(all(n), '0', '9');
  cout << n << rt;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n, d);
  vector<vector<int>> xs(n, vector(d, 0));
  rep(i, n) rep(j, d) cin >> xs[i][j];
  int ans = 0;
  rep(i, n - 1) for (int j = i + 1; j < n; ++j) {
    int sum = 0;
    auto sq = [](int x) { return x * x; };
    rep(k, d) sum += sq(xs[i][k] - xs[j][k]);
    for (int k = 0; k * k <= sum; ++k) {
      if (k * k == sum) ++ans;
    }
  }
  out(ans);
}


Measured memory_bytes: 3592
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let n: usize = read();

    let mut ans: usize = 0;
    // for x in 0..=b {
    //     let a = (a*(x as f64)/b) as usize - ((x as f64)/b) as usize;
    //     if ans < a {
    //         ans = a;
    //     }
    // }
    if n >= b {
        ans = (a as f64 * (b-1) as f64 / b as f64) as usize;
    } else {
        ans = (a as f64 * n as f64 / b as f64) as usize;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2080
#include <iostream>
using namespace std;
 
int main(){
 
  int N,d1,d2;
  int c=0;
  
  cin >> N;
  
  for(int i=1; i<=N; i++){
   
    cin >> d1 >> d2;
    
    if(d1==d2)c++;
    else c=0;
    
    if(c==3) break;
  }

  if(c==3) cout << "Yes";
  else cout << "No";
  
  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 300010
using namespace std;
int n;
char s[maxn];
int p1[maxn],p2[maxn];
int ans=2147483647;
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)  	p1[i]=p1[i-1]+(s[i]=='W');
	for(int i=n;i>=1;i--)   p2[i]=p2[i+1]+(s[i]=='E');
	for(int i=1;i<=n;i++)
	{
		ans=min(ans,p1[i-1]+p2[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <bitset>

using ll = long long;
using namespace std;

struct F {
	ll b;
	int e;
};

int main() {
	while (true) {
		ll N;
		cin >> N;
		if (N == 0) break;

		string S;
		cin >> S;
		reverse(S.begin(), S.end());

		F a = {1LL << 52, 0};
		for(int i = 0; i < 52; ++i) {
			if (S[i] == '1') a.b += (1LL << i);
		}

		F ans = a;

		while (N > 0) {
			ans.b += a.b;
			if (ans.b >= (1LL << 53)) {
				ans.b >>= 1;
				ans.e += 1;
				a.b >>= 1;
				a.e += 1;
				--N;
			}

			ll ok = 0, ng = min(N + 1, 1LL << (a.e + 1));
			// don't occur carry in ans + a * ok

			while (ng - ok > 1) {
				ll mid = (ok + ng) / 2;
				if (ans.b + a.b * mid < (1LL << 53)) {
					ok = mid;
				} else {
					ng = mid;
				}
			}

			ans.b += a.b * ok;
			N -= ok;
		}

		cout << bitset<12>(ans.e) << bitset<52>(ans.b) << endl;
	}
	return 0;
}


Measured memory_bytes: 3156
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・1,11,111,...に分解して9個ずつまとめる
・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい
・xが満たせばx+1も満たすので、二分探索できる
"""

N = [x - ord('0') for x in map(int,read().rstrip())][::-1]

# とりあえず 9 倍
N = [9 * x for x in N] + [0] * 10
L = len(N)

for i in range(L-1):
    q,r = divmod(N[i],10)
    N[i] = r
    N[i+1] += q

high1 = sum(N[10:])
N[10] += 1
for i in range(10,L-1):
    if N[i] == 10:
        N[i] = 0
        N[i+1] += 1
high2 = sum(N[10:])
low = N[:10]

low = sum(x * 10 ** i for i,x in enumerate(N[:10]))

A = 10 ** 10

def digit_sum(N):
    return sum(map(int,str(N)))

def test(x):
    if low + x >= A:
        return digit_sum(low + x) - 1 + high2 <= x
    return digit_sum(low + x) + high1 <= x

left = 0
right = 10 ** 10
while left + 1 < right:
    x = (left + right) // 2
    if test(x):
        right = x
    else:
        left = x

answer = (right + 8) // 9
print(answer)

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

int main() {
    string s;
    cin >> s;

    int x = stoi(s);
    int sum = 0;
    for(char c : s) sum += c - '0';
    if(x % sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;
int n, m, *x, a, b;
map<int, vector<int> > mp;
int go(int i)
{
    if(mp.find(i) == mp.end())
        return 0;
    if(~x[i - 1])
        return x[i - 1];
    for(int j = 0; j < mp[i].size(); j++)
        x[i - 1] = max(x[i - 1], go(mp[i][j]) + 1);
    return x[i - 1];
}
int main()
{
    cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    cin >> n >> m;
    x = new int[n];
    memset(x, -1, 4 * n);
    for(int i = 0; i < m; i++)
    {
        cin >> a >> b;
        mp[a].push_back(b);
    }
    for(map<int, vector<int> >::iterator it = mp.begin(); it != mp.end(); it++)
        x[it->first - 1] = go(it->first);
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans = max(ans, max(x[i], 0));
    cout << ans;
}

Measured memory_bytes: 14976
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int five_cnt = 0, seven_cnt = 0;
    for(int i = 0; i < 3; i++)
    {
        int num;
        cin >> num;
        if(num == 5) five_cnt++;
        if(num == 7) seven_cnt++;
    }
    if(five_cnt == 2 && seven_cnt == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
}

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

// A
int main()
{
    int k, a, b;
    cin >> k;
    cin >> a >> b;

    bool ok = false;
    if ((a % k == 0) || (b % k == 0)) ok = true;
    if ((a / k) != (b / k)) ok = true;

    if (ok) cout << "OK";
    else cout << "NG";

    return 0;
}


Measured memory_bytes: 3564
import sys
import collections
import math
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert len(A) == N
    ball = collections.Counter(A)
    total = 0
    for i in ball.values():
        if i >= 2:
            total += combinations_count(i, 2)
    for k in range(N):
        if ball[A[k]] == 2:
            print(total - 1)
        elif ball[A[k]] == 1:
            print(total)
        else:
            print(total - ball[A[k]] + 1)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    main()


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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

//constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s,t;
	cin>>s>>t;
	int ans=0;
	int cnt=0;
	vector<int>used(1000);
	vector<int>place(t.size());
	for(int i=0;i<s.size();i++){
		if(cnt<t.size()&&s[i]==t[cnt]){
			place[cnt]=i;
			cnt++;
		}
	}
	if(cnt<t.size()){
		cout<<"no\n";
		return 0;
	}
	place.push_back(s.size());
	for(int i=t.size()-1;i>=0;i--){
		cnt=i;
		for(int j=place[i]+1;j<place[i+1];j++){
			if(s[j]==t[i]){
				cout<<"no\n";
				return 0;
			}
		}
	}
	cout<<"yes\n";
	return 0;
}


Measured memory_bytes: 8168
#pragma comment(linker, "/stack:200000000")
 #pragma GCC optimize("Ofast")
 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 #include<bits/stdc++.h>
 #define int long long
 using namespace std;
//  map<int,int>mm1,mm2;
// int pre[200015];

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

     clock_t clk;
 	clk = clock();
 
// -------------------------------------Code starts here--------------------------------------------------------------------- 

    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2)
        cout<<"No";
    else
    {
        if(s.substr(0,n/2)==s.substr(n/2,n/2))
            cout<<"Yes";
        else
        {
            cout<<"No";
        }
        
    }
    

// -------------------------------------Code ends here------------------------------------------------------
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

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

int N, W;
int value[1001], weight[1001];
int dp[101][100001];

int main(void)
{

    cin >> N >> W;
    for (int i=0; i<N; ++i) cin >> value[i] >> weight[i];
    for (int i=0; i<N; ++i) dp[0][i] = 0;

    for (int i=0; i<N; ++i) {
        for (int w=0; w<=W; ++w) {
            if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
            else dp[i+1][w] = dp[i][w];
        }
    }
    cout << dp[N][W] << endl;
}



Measured memory_bytes: 7392
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

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

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

int main() {
  string S;
  cin >> S;

  for (int i = 0; i < 3; i++) {
    char temp;
    if (S[i] > S[i + 1]) {
      temp = S[i + 1];
      S[i + 1] = S[i];
      S[i] = temp;
      i = -1;
    }
  }

  if ( S[0]==S[1]
    && S[2]==S[3]
    && S[1]!=S[2] )
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n,c=0;
    string s;
    cin>>n>>s;
    rep(i,n-2){
        if (s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C') {
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<set>
using namespace std;
int main()
{
    string s,t;
    int a;
    cin>>a;
    cin>>s;
    cout<<a+1<<s<<t;
    system("pause");
    return 0;
}           

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

int x[50],y[50],r[50],c[50];
int n;

char dp[1 << 24];

int main(){
  while(cin >> n,n){
    vector<bool> used(50);
    int ond[50] = {};
    for(int i = 0; i < n; i++){
      cin >> x[i] >> y[i] >> r[i] >> c[i];
      ond[i] = 0;
      for(int j = 0; j < i; j++){
        int dx = abs(x[i] - x[j]);
        int dy = abs(y[i] - y[j]);
        int dr = r[i] + r[j];
        if(dx * dx + dy * dy < dr * dr){
            ond[i] |= (1 << j);
        }
      }
    }
    int ans = 0;
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    for(int bit = 0; bit < 1 << n; bit++){
        if(dp[bit] == -1) continue;
        ans = max(ans, (int)dp[bit]);
        for(int i = 0; i < n - 1; i++){
            if((bit & (1 << i)) != 0 || (ond[i] & bit) != ond[i]) continue;
            for(int j = i + 1; j < n; j++){
                if(c[i] != c[j] || (bit & (1 << j)) != 0 || (ond[j] & bit) != ond[j]) continue;
                int nx = bit | (1 << i) | (1 << j);
                dp[nx] = max((int)dp[nx], dp[bit] + 2);
            }
        }
      }
      cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 19468
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from fractions import gcd
from functools import reduce

N,*A = map(int,read().split())

MOD = 10 ** 9 + 7

lcm = 1
answer = 0
for x in A:
  n = x//gcd(lcm,x)
  lcm *= n
  answer *= n 
  answer %= MOD
  answer += lcm//x % MOD
  
answer %= MOD
print(answer)


Measured memory_bytes: 5984
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"----------------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
#define bug(x) cerr << "[" << #x << "] = ["<<x<<"]"<<'\n'
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int sum=0;
    for(int i=0;i<b;i++)
    {
        int c; cin>>c;
        sum+=c;
    }
    if(sum>=a) puts("Yes");
    else puts("No");
}
	
		

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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    ll a[n];
    multiset<ll> st;
    pair<ll,ll> p[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        p[i] = make_pair(a[i],i);
    }
    st.insert(n), st.insert(n),st.insert(n);
    st.insert(-1), st.insert(-1),st.insert(-1);
    sort(p,p+n,greater<pair<ll,ll>>());

    ll l1[n],l2[n],r1[n],r2[n];
    for(ll i=0;i<n;i++){
        auto it = st.lower_bound(p[i].second);
        r1[i] = *it;
        auto l = it;
        it++; r2[i] = *it;
        l--;
        l1[i] = *l;
        l--; l2[i] = *l;
        st.insert(p[i].second);
    }
    ll ans = 0;
    for(ll i=0;i<n;i++){
        ll t = p[i].first, k = p[i].second;
        ans += t * ((l1[i] - l2[i])*(r1[i] - k) + (r2[i] - r1[i]) * (k - l1[i]));
        //cerr<<(l1[i] - l2[i])<< " " <<(r1[i] - k) <<" "<< (r2[i] - r1[i]) << " "  << k - l1[i] << endl;
    }
    cout << ans << endl;

}

Measured memory_bytes: 10368
#include <stdio.h>

int main(void){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a < b){
		printf("a < b\n");
	}
	else if(a > b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2060
def main():
    MOD = 1000000007
    N, K = map(int, input().split())
    L, R = list(range(N + 1)), list(range(N + 1))[::-1]
    for i in range(N):
        L[i + 1] += L[i]
        R[i + 1] += R[i]
    ans = 0
    for i in range(K - 1, N + 1):
        ans = (ans + R[i] - L[i] + 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  
  set<int> mochi;
  for (int i = 0; i < N; i++) {
    int size;
    cin >> size;
    mochi.insert(size);
  }

  cout << mochi.size() << endl;  
}


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

int main(){
    int n; cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for(int i=2; i<=n; i++) F[i] = F[i-1] + F[i-2];
    
    cout << F[n] << endl;
    
    return 0;
}


Measured memory_bytes: 3112
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int x[10];
int y[10];

int main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> x[i]>>y[i];
    }
    double ans=0;
    
    //順列生成　next_permutation
    vector<ll> v(n);
    rep(i,n){
        v[i]=i;
    }
    do{
        rep(i,n-1){
            int temp=(x[v[i]]-x[v[i+1]])*(x[v[i]]-x[v[i+1]])+(y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]);
            ans+=sqrt(temp);
            cerr<<sqrt(temp)<<endl;
            cerr<<v[i]+1<<' ';
        }
        cerr<<v[n-1]+1;
        cerr<<endl;
    }while(next_permutation(v.begin(),v.end()));
    /*
    rep(i,n){
        reps(j,i+1,n){
            int temp=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
            ans+=sqrt(temp);
        }
    }
    */
    double N=1;
    while(n>0){
        N*=n;
        n--;
    }
    cerr<<N<<endl;
    printf("%.10lf\n",ans/N);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check
const ll INF=1LL<<60;

const long long MOD = 1000000007;

void solve(long long N, std::vector<long long> T, std::vector<long long> A){
    if(N == 1){
        if(T[0]==A[0]){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
        return;
    }

    vector<pll> p(N, pll(0, INF));
    p[0].first = T[0]; p[0].second = T[0]+1;
    p[N-1].first = A[N-1]; p[N-1].second = A[N-1]+1;
    for(ll i=1; i< N; i++){
        if(T[i]==T[i-1]){
            p[i] = make_pair(max(p[i].first, 1LL), min(p[i].second, T[i]+1));
            if(p[i].first >= p[i].second){
                cout << 0 << endl;
                return;
            }
        }
        else{
            p[i] = make_pair(max(p[i].first,T[i]), min(p[i].second, T[i]+1));
            if(p[i].first >= p[i].second){
                cout << 0 << endl;
                return;
            }
        }
    }
    for(ll i= N-2; i>=0; i--){
        if(A[i]==A[i+1]){
            p[i] = make_pair(max(p[i].first, 1LL), min(p[i].second, A[i]+1));
            if(p[i].first >= p[i].second){
                cout << 0 << endl;
                return;
            }
        }
        else{ //* A[i] > A[i+1]
            p[i] = make_pair(max(p[i].first,A[i]), min(p[i].second, A[i]+1));
            if(p[i].first >= p[i].second){
                cout << 0 << endl;
                return;
            }
        }
    }
    ll res = 1;
    REP(i, N){
        res = (res * (p[i].second-p[i].first)) % MOD;
    }
    cout << res << endl;
    
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> T(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&T[i]);
    }
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(T), std::move(A));
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int A,B,C,N;
int banboos[9];
int dfs(int a,int b,int c,int l)
{
	if(l==N)
	{
		if(a==0||b==0||c==0)
		{
			return 8001;
		}
		return abs(A-a)+abs(B-b)+abs(C-c);
	}
	//printf("%d %d %d %d\n",a,b,c,l);
	int r1=dfs(a+banboos[l+1],b,c,l+1)+10;
	int r2=dfs(a,b+banboos[l+1],c,l+1)+10;
	int r3=dfs(a,b,c+banboos[l+1],l+1)+10;
	int r4=dfs(a,b,c,l+1);
	return min(min(r1,r2),min(r3,r4));
}
int main() 
{
	scanf("%d %d %d %d",&N,&A,&B,&C);
	for(int i=0;i<N;i++)
	{
		scanf("%d",&banboos[i+1]);
	}
	int n=dfs(0,0,0,0);
	printf("%d",n-30);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    s = kwargs["s"]

    if s == 'ABC':
        res = 'ARC'
    else:
        res = 'ABC'

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["s"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    #kwargs["n"], kwargs["k"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

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

int main() {

    int x;
    cin >> x;

    cout << 1 - x << endl;

    return 0;
}


Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		// ABC104-C ng
		static void Main(string[] args)
		{
			string[] vs = Console.ReadLine().Split();
			int D = int.Parse(vs[0]);   // 種類		1～10
			int G = int.Parse(vs[1]);   // 目標点
			int[] count = new int[D];   // 問題数	1～100
			int[] basic = new int[D];   // 基本点
			int[] bonus = new int[D];   // 追加点	100～1,000,000
			for (int i = 0; i < D; i++) {
				vs = Console.ReadLine().Split();
				count[i] = int.Parse(vs[0]);
				basic[i] = (i + 1) * 100;
				bonus[i] = int.Parse(vs[1]);
			}

			int answer = int.MaxValue;
			Queue<Item> items = new Queue<Item>();
			HashSet<string> hashSet = new HashSet<string>();
			items.Enqueue(new Item(D));
			while (items.Count > 0) {
				Item item = items.Dequeue();
				if (item.Point >= G) {
					answer = Math.Min(answer, item.Answer);
				} else {
					for (int i = D - 1; i >= 0; i--) {
						if (item.Count[i] == 0) {
							int k = (G - item.Point) / basic[i] + ((G - item.Point) % basic[i] > 0 ? 1 : 0);
							if (k < count[i]) {
								answer = Math.Min(answer, item.Answer + k);
							}
							break;
						}
					}
				}

				for (int i = 0; i < D; i++) {
					if (item.Count[i] == 0) {
						Item tmp = new Item(item);
						tmp.Answer += count[i];
						tmp.Count[i] = count[i];
						tmp.Point += basic[i] * count[i] + bonus[i];
						if (!hashSet.Contains(tmp.ToString())) {
							items.Enqueue(tmp);
							hashSet.Add(tmp.ToString());
						}
					}
				}
			}
			Console.WriteLine(answer);
		}
	}

	public class Item
	{
		public int Answer = 0;
		public int[] Count;
		public int Point = 0;

		public Item(int c)
		{
			Count = new int[c];
		}

		public Item(Item item)
		{
			Answer = item.Answer;
			Count = (int[])item.Count.Clone();
			Point = item.Point;
		}

		public override string ToString()
		{
			return string.Join(",", Count.Select(p => p.ToString("D3")));
		}
	}

}


Measured memory_bytes: 15608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  double s=0;
  for(int i=0;i<n;i++){
    double x;
    string u;
    cin>>x>>u;
    s+=(u=="JPY"?x:380000*x);
  }
  cout<<fixed<<setprecision(10)<<s<<endl;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;

const ld PI = 3.1415926535897932384626433;

ld solve(ld a, ld b, ld theta) {
  if (b*cos(theta) > a*sin(theta)) {
    ld ans = 0;
    ans += a*a*a*tan(theta)/2;
    //cerr << " >>>> " << b-a*tan(theta) << endl;
    ans += (b-a*tan(theta))*a*a;
    return ans;
  } else {
    //cerr << " b " << b << " b*a " << b*a << " b*a/tan(theta) " << b*a/tan(theta) << " b*a/tan(theta)*a " << b*a/tan(theta)*a << " THETA " << theta << endl;
    return b*b/tan(theta)*a/2;
  }
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  ld a, b, x;
  cin >> a >> b >> x;

  ld lo = 0, hi = PI/2;

  for (int i=0; i<50; ++i) {
    ld mid = (lo+hi)/2;
    ld cap = solve(a, b, mid);
    if (cap > x) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  //cerr << "~~ " << endl;
  //cerr << " :: " <<fixed << setprecision(10) << solve(a, b, 89.7834636934/180*PI) << endl;
  //cerr << " :: " <<fixed << setprecision(10) << solve(a, b, 89.81/180*PI) << endl;
  cout << fixed << setprecision(10) << hi*180/PI << endl;

  return 0;
}


Measured memory_bytes: 4024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=1000010, Mod=1e9+7;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int n,a[N],qwq,w;
signed main()
{
    n=read();
    for(ri int i=1;i<=n;i++) a[i]=read();
    for(ri int i=3;i<=n;i++) qwq^=a[i];
    w=a[1]+a[2];
    int g=w-qwq;
    if(g<0 || (g&1) || g/2>a[1] || ((g/2)&qwq)) { puts("-1"); return 0; }
    int t=g/2;
    for(ri int i=(1ll<<50);i;i>>=1)
    {
        if((qwq&i) && a[1]>=t+i) t+=i;
    }
    if(!t) puts("-1");
    else printf("%lld\n",a[1]-t);
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1*60 + m1;
    int t2 = h2*60 + m2;
    cout << t2-t1-k << endl;
}


Measured memory_bytes: 3608
#include <stdio.h>
int selectionSort(int A[],int N) {
	int counter = 0;
	for (int i = 0;i < N;i++) {
		int minj = i;
		for (int j = i;j < N;j++) {
			if (A[j] < A[minj])
				minj = j;
		}
		if (!(i == minj)) {
			int dumy = A[i];
			A[i] = A[minj];
			A[minj] = dumy;
			counter++;
		}
	}
	for (int i = 0;i < N;i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");

	return counter;
}
int main() {
	int N,i;
	int A[100];
	scanf("%d", &N);
	for (i = 0;i < N;i++)
		scanf("%d", &A[i]);
	printf("%d\n", selectionSort(A, N));
}


Measured memory_bytes: 2748
#メイン処理
H,W = map(int,input().split())
S = []
 
#二次元配列
for _ in range(H):
    a = input()
    S.append(list(a))
 
maxlamp = 0

L = [[0] * W for i in range(H)] #左
R = [[0] * W for i in range(H)] #右
D = [[0] * W for i in range(H)] #下
U = [[0] * W for i in range(H)] #上

# L = np.zeros((H,W))
# R = np.zeros((H,W))
# D = np.zeros((H,W))
# U = np.zeros((H,W))
 
#Lの計算
for _h in range(H):
    for _w in range(W):
        if S[_h][_w] != '#':
            if _w == 0:
                L[_h][_w] = 1
            elif _w > 0:
                L[_h][_w] = L[_h][_w-1] + 1
    
            if _h == 0:
                U[_h][_w] = 1
            elif _h > 0:
                U[_h][_w] = U[_h-1][_w] + 1
 
for _h in range(H-1,-1,-1):
    for _w in range(W-1,-1,-1):
        if S[_h][_w] != '#':
            if _w == W-1:
                R[_h][_w] = 1
            elif _w < W-1:
                R[_h][_w] = R[_h][_w+1] + 1
 
            if _h == H-1:
                D[_h][_w] = 1
                
            elif _h < H-1:
                D[_h][_w] = D[_h+1][_w] + 1
        
            tmp = L[_h][_w] + R[_h][_w] + U[_h][_w] + D[_h][_w] - 3
            maxlamp = max(maxlamp,tmp)
 
print(maxlamp)


Measured memory_bytes: 308360
#include <iostream>

using namespace std;

long long ca, cb, cc, i;

string s;

int main()
{
    cin >> s;
    for(i = 0; i <= 2; i ++){
        if(s[i] == 'a')ca++;
        else if(s[i] == 'b')cb ++;
        else cc ++;
    }
    if(ca == 1 && cb == 1 && cc == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

	while(sc.hasNext()){

	    int d = sc.nextInt();
	    
	    List<Integer> f = new ArrayList<Integer>();
	    for(int i=0;; i++){
		if(d*(i+1)<=600-d){
		    f.add((d*(i+1))*(d*(i+1))*d);
		}else{break;}
	    }
	    
	    int sum = 0;
	    for(int i=0; i<f.size(); i++){
		sum += f.get(i);
	    }
	    
	    System.out.println(sum);
	}
    }
}

Measured memory_bytes: 0
x,y,z = map(int,input().split())
 
dp = [y-z for i in range(x)]
 
for j in range(z):
    k = int(input())
    dp[k-1] += 1
 
for l in dp:
    if l >= 1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 7896
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;


int main(){
    int x, y; cin >> x >> y;
    int ans = 0;
    if(x <= 3) ans += (4-x)*100000;
    if(y <= 3) ans += (4-y)*100000;
    if(x == 1 && y == 1) ans += 400000;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
from collections import deque


def is_bipartite_graph(graph):
    """二部グラフかどうか判定し、黒色白色で塗り分けるときのそれぞれの頂点の個数を返す
    二部グラフでないときは(-1, -1)を返す
    """
    n = len(graph)
    visited = [-1] * n
    visited[0] = 0
    q = deque([0])
    while q:
        pos = q.pop()
        for next_pos in graph[pos]:
            if visited[next_pos] >= 0:
                if visited[next_pos] != visited[pos]:
                    continue
                else:
                    return -1, -1
            visited[next_pos] = visited[pos] ^ 1
            q.append(next_pos)
    cnt_0 = 0
    cnt_1 = 0
    for i in range(n):
        if visited[i]:
            cnt_1 += 1
        else:
            cnt_0 += 1
            
    return cnt_0, cnt_1
  
n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]

graph = [[] for i in range(n)]
for i in range(m):
    a, b = info[i]
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

cnt_0, cnt_1 = is_bipartite_graph(graph)

#二部グラフではないとき -> 完全グラフを作る
if cnt_0 == -1:
    ans = (n*(n-1))//2 - m
#二部グラフのとき -> 完全二部グラフを作る
else:
    ans = cnt_0 * cnt_1 - m
print(ans)


Measured memory_bytes: 75224
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef int64_t Int;
const double pi = M_PI;

int main()
{
    int H, W;

    while (true)
    {
        cin >> H >> W;
        if (H == 0 && W == 0)
        {
            break;
        }

        for (Int i = 0; i < H; i++)
        {
            for (Int j = 0; j < W; j++)
            {
                if ((i + j) % 2 == 0)
                {
                    cout << '#';
                }
                else
                {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int n, Ma, Mb;
int a[45], b[45], c[45];
int dp[45][405][405];

void DP(){
    dp[0][0][0] = 0;
    rep(i, n){
        rep(j, 405){
            rep(k, 405){
                if(dp[i][j][k] == INF) continue;
                dp[i + 1][j][k] = min(dp[i][j][k], dp[i + 1][j][k]);
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i][j][k] + c[i], dp[i + 1][j + a[i]][k + b[i]]);
            }
        }
    }
}

int main(){
    cin >> n >> Ma >> Mb;
    rep(i, n){
        cin >> a[i] >> b[i] >> c[i];
    }
    rep(i, 45)rep(j, 405)rep(k, 405) dp[i][j][k] = INF;
    DP();

    int ans = INF;
    REP(i, 1, 405){
        REP(j, 1, 405){
            if(i * Mb == j * Ma)ans = min(ans, dp[n][i][j]);
        }
    }
    if(ans == INF)cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 29056
#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;

const int MOD = 1000000007;
int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int h, w;
  cin >> h >> w;
  int n;
  int A[h][w];
  cin >> n;
  int arr[n];
  for(int i = 0;i < n;i++)
    cin >> arr[i];
  int c = 0;

  for(int i = 0;i < h;i++){
    for(int j = (i & 1) ? w - 1 : 0;j >= 0 && j < w;j += (i & 1) ? -1 : 1){
      while(!arr[c])c++;
      A[i][j] = c + 1;
      arr[c]--;
    }
  }
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cout << A[i][j] << ' ';
    }
    cout << endl;
  }
}



Measured memory_bytes: 384
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    A.sort()
    a0 = A[0]
    a3 = A[N-1]
    A12 = A[1:N-1]
    iz = bisect_left(A12, 0)
    A1 = A12[:iz]
    A2 = A12[iz:]

    logs = []
    def logging(x, y):
        logs.append('%d %d' % (x, y))
        return x - y
    x = a0
    for y in A2:
        x = logging(x, y)
    y = x
    x = a3
    x = logging(x, y)
    for y in A1:
        x = logging(x, y)
    print(x)
    for log in logs:
        print(log)

main()


Measured memory_bytes: 66876
#include<stdio.h>
#include<ctype.h>

int main(void){
   int i;
   char str[1205];
   scanf("%[^\n]",str);
   for(i=0;str[i]!='\0';i++){
      if( islower(str[i]) ){printf("%c",toupper(str[i]));}
      else if( isupper(str[i]) ){printf("%c",tolower(str[i]));}
      else printf("%c",str[i]);
   }
   printf("\n");
   return 0;
}



Measured memory_bytes: 2040
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

int main(void) {
    int n;
    std::scanf("%d", &n);
    int d[n];
    for (int i = 0; i < n; i++) {
        std::scanf("%d", d + i);
    }
    int m;
    std::scanf("%d", &m);
    int t[m];
    for (int i = 0; i < m; i++) {
        std::scanf("%d", t + i);
    }
    std::sort(d, d + n);
    std::sort(t, t + m);
    int p = 0;
    for (int i = 0; i < n; i++) {
        if (d[i] == t[p]) {
            p++;
        }
    }
    std::puts(p == m ? "YES" : "NO");
    return 0;
}

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

int main() {
  long long n;
  cin >> n;
  
  if (n / 100 == 9) {
    n = n - 900 + 100;
  } else if (n / 100 == 1) {
    n = n - 100 + 900;
  }
  
  if (n / 10 % 10 == 9) {
    n = n - 90 + 10;
  } else if (n / 10 % 10 == 1) {
    n = n - 10 + 90;
  }
  
  if (n % 10 == 9) {
    n = n - 9 + 1;
  } else if (n % 10 == 1) {
    n = n - 1 + 9;
  }
  
  cout << n << endl;
  
  return 0;
}

Measured memory_bytes: 256