akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define eps 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N, M;

int main () {
  cin >> N >> M;

  if (N != M) cout << "No\n";
  else cout << "Yes\n";
}

Measured memory_bytes: 256
n = int(input())
s =list(input())
curr = 0
l  = n-1
count = 0
while(l>=0 and l>curr):
    #print(l,curr,s)
    if s[l]=='R' and s[curr]=='R' and l==curr:
        l-=1
        curr+=1
    elif s[l]=='R' and s[curr]=='W':
        s[curr]='R'
        s[l]='W'
        count+=1
        l-=1
        curr+=1
    elif s[l]=='R' and s[curr]=='R':
        curr+=1
    else:
        l-=1
print(count)

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

using namespace std;

int main() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;

  vector<int> v(n + 1);
  for (int i = 1; i < n; i++) {
    int x = 0;
    if (s[i - 1] == 'A' && s[i] == 'C') x = 1;
    v[i + 1] = v[i] + x;
  }

  int l, r;
  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    cout << v[r] - v[l] << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
/*   三玖天下第一！！！  */
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5,maxd=10;
int n,m,Q,_39[maxn+5]={},lin[maxn+5]={},len=0;
bool vis[maxn+5][maxd+5]={};
struct edge{int y,next;}e[(maxn<<1)+5];
inline void insert(int xx,int yy){e[++len]={yy,lin[xx]};lin[xx]=len;}
inline int dread()
{
	int x=0;bool f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())f^=(ch=='-');
	for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
	return f?x:-x;
}
struct operation
{
	int v,d,c;
	inline void read(){v=dread();d=dread();c=dread();}
}opt[maxn+5];
void color(int point,int dis,int c)
{
	if(vis[point][dis]) return;else for(int i=0;i<=dis;i++)vis[point][i]=1;
	if(!_39[point]) _39[point]=c;
	if(!dis) return;
	for(int i=lin[point];i;i=e[i].next) color(e[i].y,dis-1,c);
}
inline void Kaslana()
{
	n=dread();m=dread();
	for(int i=1,u,v;i<=m;i++) insert(u=dread(),v=dread()),insert(v,u);
	Q=dread();
	for(int i=1;i<=Q;i++) opt[i].read();
}
inline void Raiden()
{
	for(int i=Q;i>=1;i--) color(opt[i].v,opt[i].d,opt[i].c);
}
inline void Zaychik()
{
	for(int i=1;i<=n;i++) printf("%d\n",_39[i]);
}
int main()
{
    Kaslana(),Raiden(),Zaychik();return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a, b, c, d;
      int L = 0, R = 0;
      cin >> a >> b >> c >> d;
      L = a + b;
      R = c + d;
      if (L > R) {
       cout << "Left" << endl; 
      }
      else if (L == R){
        cout << "Balanced" << endl;
      }
      else {
        cout << " Right" << endl;
      }
    }

Measured memory_bytes: 256
//SccPuzzle.cpp (C)
#include <iostream>
#include <string>
using namespace std;

int main(){
  long long N,M,Ans;
  cin >> N >> M;
  if(2*N >= M){
    Ans = M/2;    
  }else{
    Ans = N;
    M -= 2*N;
    Ans += M/4;
  }
  printf("%lld\n",Ans);
  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc051/tasks/abc051_c

sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans = ''

for a in range(dx):
    ans += 'R'

for b in range(dy + 1):
    ans += 'U'

for c in range(dx + 1):
    ans += 'L'

for d in range(dy + 1):
    ans += 'D'

ans += 'R'

ans += 'D'

for e in range(dx + 1):
    ans += 'R'

for f in range(dy + 1):
    ans += 'U'

for g in range(dx + 1):
    ans += 'L'

for h in range(dy):
    ans += 'D'

print(ans)

Measured memory_bytes: 3064
i = int(input())

gift = dict()

# print(gift.get('aaa'))

for i in range(i):
  value = input()
  # print(value)
  # print(gift.get(value))
  if gift.get(value) == None:
    gift[value] = 1
  else:
    gift[value] += 1

# print(gift)

print(len(gift))

Measured memory_bytes: 35068
#include <stdio.h>
int main(void){
    int i,j,a[4],b[4];
    int hit,blow;
    
    while(scanf("%d %d %d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3]) != EOF){
        hit=blow=0;
        for(i=0;i<4;i++){
            if(a[i]==b[i]){
                hit++;
                continue;
            }
            for(j=0;j<4;j++){
                if(j==i)continue;
                if(a[i]==b[j])blow++;
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int a,b,c,d,x,y;
  cin>>a>>b>>c>>d;
  x=(d-b)*-1;
  y=c-a;
  cout<<c+x<<' '<<d+y<<' '<<a+x<<' '<<b+y<<endl;
  
  
  
  
  
  
  
}


Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;


#include <queue>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <iterator>

using COST_T = uint32_t;
constexpr uint32_t N_MAX = 11;
constexpr COST_T INF = 100000000;
struct edge {
	uint32_t to;
	COST_T cost;
	edge() {}
	edge(uint32_t to_, COST_T cost_)
		:to(to_), cost(cost_) {}
};
std::vector<edge> graph[N_MAX];

//ダイクストラ
COST_T D_[N_MAX][N_MAX];
void Dijkstra(uint32_t s)
{
	auto&D = D_[s];
	using P = std::pair<COST_T, uint32_t>;//cost pos
	std::priority_queue<P, std::vector<P>, std::greater<>> que;
	std::fill(std::begin(D), std::end(D), INF);
	D[s] = 0;
	que.emplace(0, s);
	while (!que.empty())
	{
		auto p = que.top(); que.pop();
		const auto& nowpos = p.second;
		const auto& nowcost = p.first;
		if (D[nowpos] < nowcost) { continue; }

		//for (int32_t to = 0; to < N; ++to)
		//{
		//	auto cost = nowcost + graph[nowpos][to];
		//	if (cost < D[to]) {
		//		D[to] = cost;
		//		que.emplace(D[to], to);
		//	}
		//}

		for (const auto& e : graph[nowpos])
		{
			auto cost = nowcost + e.cost;
			if (cost < D[e.to]) {
				D[e.to] = cost;
				que.emplace(cost, e.to);
			}
		}

	}
}



int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	int32_t H, W;

	in >> H >> W;
	for (int32_t a = 0; a < 10; a++)
	{
		for (int32_t b = 0; b < 10; b++)
		{
			int c;
			in >> c;
			graph[a].emplace_back(b, c);
		}
	}
	for (int32_t i = 0; i < 10; i++)
	{
		Dijkstra(i);
	}
	int64_t sum = 0;
	for (int32_t i = 0; i < H; i++)
		for (int32_t j = 0; j < W; j++)
		{
			int a;
			in >> a;
			if (a != -1) { sum += D_[a][1]; }
		}
	out << sum << endl;

	return 0;
}
#endif


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

int main() {
  string s;
  cin >> s;
  int payment = 700;
  if (s[0] == 'o') payment += 100;
  if (s[1] == 'o') payment += 100;
  if (s[2] == 'o') payment += 100;
  cout << payment << endl;

  return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	ll n, m, a[1010], b[1010], c[1010], ans = -INF2, d[10][1010] = { 0 }, s[10] = { 0 };
	cin >> n >> m;
	for (int i = 0;i < n;i++) {
		cin >> a[i] >> b[i] >> c[i];
		d[0][i] = a[i] + b[i] + c[i];
		d[1][i] = a[i] + b[i] - c[i];
		d[2][i] = a[i] - b[i] - c[i];
		d[3][i] = -a[i] - b[i] - c[i];
		d[4][i] = a[i] - b[i] + c[i];
		d[5][i] = -a[i] + b[i] + c[i];
		d[6][i] = -a[i] - b[i] + c[i];
		d[7][i] = -a[i] + b[i] - c[i];
	}
	sort(d[0], d[0] + n);
	sort(d[1], d[1] + n);
	sort(d[2], d[2] + n);
	sort(d[3], d[3] + n);
	sort(d[4], d[4] + n);
	sort(d[5], d[5] + n);
	sort(d[6], d[6] + n);
	sort(d[7], d[7] + n);
	for (int i = n - 1;i >= n - m;i--) {
		s[0] += d[0][i];
		s[1] += d[1][i];
		s[2] += d[2][i];
		s[3] += d[3][i];
		s[4] += d[4][i];
		s[5] += d[5][i];
		s[6] += d[6][i];
		s[7] += d[7][i];
	}
	cout << max({ s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7] }) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
#define f first
#define s second

using namespace std;

const int maxn = (int)(1e5)+2;
const int inf = (int)(1e9)+7;


int n, m, k;
ll d[maxn];
vector <pair <int,int> > g[maxn];
void dfs(int v, int p = -1) {
  	for (int i = 0;i<g[v].size(); i++) {
  	 	int to = g[v][i].f, w = g[v][i].s;
  	 	if (to==p) continue;
  	 	d[to] = d[v] + w;
  	 	dfs(to,v);
  	}
}

int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
	 	int u,v,w;
	 	cin >> u >> v >> w;
	 	g[u].pb(mp(v,w));
	 	g[v].pb(mp(u,w));
	}
	cin >> m >> k;
	dfs(k);
	for (int i = 1,a,b; i <= m; i++) {
	 	cin >> a >> b;
	 	cout << d[a] + d[b] << endl;
	}

	return 0;
}

Measured memory_bytes: 14336
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int [n];
		int[] b = new int [n];
		int[] c = new int [n];
		for(int d = 0; d < n ; d++){
			a[d] = scan.nextInt();
			b[d] = scan.nextInt();
			c[d] = scan.nextInt();
		}
		for(int e = 0;e < n ; e++){
			if((a[e]*a[e]+b[e]*b[e]==c[e]*c[e]) || (b[e]*b[e]+c[e]*c[e]==a[e]*a[e]) || (c[e]*c[e]+a[e]*a[e]==b[e]*b[e])){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 24012
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(x) x.begin(),x.end()
#define endl '\n'
#define INF 1e9+7
using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using pii=pair<int,int>;
using ppi=pair<pii,int>;
using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;

template<typename T>
void _print(vector<T> x) {for(auto e:x) cerr<<e<<",";}
template<typename T>
void _print(T x) {cerr<<x;}

void dbg() {cerr<<endl;}
template<typename Head,typename... Tail>
void dbg(Head H,Tail... T) {
    _print(H);
    if(sizeof...(T)) cerr<<",";
    else cerr<<"\"]";
    dbg(T...);
}

#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]: [\"",dbg(__VA_ARGS__)

int main () {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,k; cin>>n>>k;
    vector<int> a(n); for(int i=0;i<n;i++) cin>>a[i];
    nth_element(a.begin(),a.begin()+k,a.end());
    cout<<accumulate(a.begin(),a.begin()+k,0)<<endl;
}



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

int main(void){
    string s;
    cin>>s;
    int n = s.size();
    map<char,int> cnt;
    rep(i,n){
        cnt[s[i]]++;
    }
    int a[] = {cnt['a'],cnt['b'],cnt['c']};
    sort(a,a+3);
    cout<<((a[2] - a[0] <= 1) ? "YES" : "NO")<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <utility>
#include <set>
#include <vector>
using namespace std;

const int MAX_SIZE = 1000;
typedef pair<int, int> P;

int calc(char f[][MAX_SIZE], vector<P> v, int H, int W) {
  int c = 0;
  int di[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
  int dj[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
  while(++c) {
    vector<P> b;
    set<P> s;
    for (vector<P>::iterator it = v.begin(); it != v.end(); ++it) {
      int i = it->first, j = it->second;
      int n = 0;
      for (int k = 0; k < 8; ++k) {
        if (i + di[k] >= 0 && i + di[k] < H &&
            j + dj[k] >= 0 && j + dj[k] < W &&
            f[i + di[k]][j + dj[k]] == '.') {
          n++;
        }
      }
      if (n >= f[i][j] - '0') {
        b.push_back(P(i, j));
        for (int k = 0; k < 8; ++k) {
          if (i + di[k] >= 0 && i + di[k] < H &&
              j + dj[k] >= 0 && j + dj[k] < W &&
              f[i + di[k]][j + dj[k]] != '.') {
              s.insert(P(i + di[k], j + dj[k]));
          }
        }
      }
    }
    if (!b.size()) {
      return c - 1;
    }
    for (vector<P>::iterator it = b.begin(); it != b.end(); ++it) {
      f[it->first][it->second] = '.';
      s.erase(P(it->first, it->second));
    }
    v = vector<P>(s.begin(), s.end());
  }
  return 0;
}

int main() {
  int H, W;
  char f[MAX_SIZE][MAX_SIZE];
  set<P> s;

  cin >> H >> W;
  for (int i = 0; i < H; ++i) {
    cin >> f[i];
    for (int j = 0; j < W; ++j) {
      if (f[i][j] != '.') {
        s.insert(P(i, j));
      }
    }
  }
  cout << calc(f, vector<P>(s.begin(), s.end()), H, W) << endl;
}

Measured memory_bytes: 56504
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では？
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

heap = []  # ヒープといっても順序を工夫したただのリスト

from heapq import heapify, heappop, heappush, heappushpop
heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))

ans = []
considerd = set()
for k_th in range(1, K+1):
    heap_max, i, j, k = heappop(heap)
    # print(heap_max)
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        if (i_new, j_new, k_new) in considerd:  # ここが計算量がおおい
            continue
        considerd.add((i_new, j_new, k_new))
        heappush(heap, (-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new))
        # print(heap)


print(*ans, sep='\n')


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

int main(){
    string s1,s2; cin>>s1>>s2;
    int idx=s1.size()-1;
    while(idx>=0){
        if(s1[idx]!=s2[idx]){
            cout<<"No"<<endl;
            return 0;
        }
        idx--;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3552
n, x = list(map(int, input().split()))

exms = []
nrm = 0

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

for i, line in enumerate(lines):
    b, l, u = line
    exms.append((u * x - b * (u - l), b, l, u, i))
    nrm += b * l
exms_sorted = sorted(exms, reverse=True)


remain_nrm = nrm

sub_d = -1
i = 0
used = set()
for i, (d, b, l, u, ei) in enumerate(exms_sorted):
    if remain_nrm < d:
        sub_d = d
        break
    remain_nrm -= d
    used.add(ei)

if sub_d == -1:
    print(n * x)
    exit()

base_ans = i * x
base_remain_nrm = remain_nrm

ans = 10 ** 10

for d, b, l, u, i in exms:
    if i in used:
        curr_remain_nrm = base_remain_nrm + d - sub_d
    else:
        curr_remain_nrm = base_remain_nrm

    if curr_remain_nrm <= b * l:
        extra = (curr_remain_nrm - 1) // l + 1
    else:
        extra = (curr_remain_nrm + b * (u - l) - 1) // u + 1
    if extra > x:
        continue
    ans = min(ans, base_ans + extra)

print(ans)


Measured memory_bytes: 72772
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		d: usize,
		x: usize,
		a: [usize; n],
	}

	let mut sum = 0;
	for i in 0..n {
		sum += (d-1)/a[i] + 1;
	}
	println!("{}", sum+x);
}



Measured memory_bytes: 2144
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

void solve(int r0,int w0,int c,int r){
  for(int i=0;;r0+=r,i++){
    if(r0>=w0*c){
      cout<<i<<endl;
      return;
    }
  }
}

int main(){ _;
  int r0,w0,c,r;
  while(cin>>r0>>w0>>c>>r,(r0|w0|c|r)!=0){
    solve(r0,w0,c,r);
  }
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d;
    while(cin>>a>>b>>c>>d,d){
        int ans=0;
        while(1){
            if((ans*d+a)>=b*c){
                cout << max(ans,0)<<endl;
                break;
            }
            ans++;
        }
    }
}

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

int main() {
  int n;
  cin>>n;
  vector<tuple<string,int,int>> a;
  for(int i=1;i<=n;i++){
    string s;
    int p;
    cin>>s>>p;
    p=-p;
    a.push_back(tie(s,p,i));
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    string s;
    int p;
    int id;
    tie(s,p,id)=a[i];
    cout<<id<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int h,w,x,y;
  cin>>h>>w>>x>>y;
  if((h*w)%2==1 && (x+y)%2==1) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;

  return 0;
}














Measured memory_bytes: 3076
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		sc.close();
		char[] ch=s.toCharArray();
		int ch0=0;
		int ch1=0;
		for(int i=0;i<ch.length;i++){
			if(ch[i]=='0'){
				ch0++;
			}else{
				ch1++;
			}
		}
		System.out.println(Math.min(ch0, ch1)*2);
	}
}

Measured memory_bytes: 26072
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

ll dp[100001];
bool live[100001];

int main() {
    cin >> N;
    int curr[3] = {0};
    ll sum = 1;
    rep(i, N){
        cin >> A;
        bool flag = true;
        ll count = 0;
        rep(j, 3){
            if(curr[j] == A){
                count++;
                if(flag){
                    flag = false;
                    curr[j]++;
                }
            }
        }
        if(flag){
            cout << 0;
            return 0;
        }
        if(count != 0) sum = (sum * count)%MOD;
    }
    cout << sum;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (int a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=1005,mod=998244353;
int h,w,acu[N][N];
char m[N][N];
int kk;
int res=998244353;
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>h>>w>>kk;
	fo(i,0,h-1) fo(j,0,w-1)  cin>>m[i][j];
	acu[0][0]=m[0][0]-'0';
	fo(i,1,w-1) acu[0][i]=acu[0][i-1]+m[0][i]-'0';
	fo(i,1,h-1) acu[i][0]=acu[i-1][0]+m[i][0]-'0';
	fo(i,1,h-1) fo(j,1,w-1) acu[i][j]=acu[i-1][j]+acu[i][j-1]-acu[i-1][j-1]+m[i][j]-'0';
int yup;
	int r=(1<<h);
	fo(i,(1<<(h-1)),r-1) {
		vi aux;
		yup=0;
		for (int j=0;j<h;j++) if (i&(1<<j)){ yup++;  aux.pb(j); }
		int ant=-1;
		vi G[N];
		for (int j=0;j<sz(aux);j++) {
			for (int k=0;k<w;k++) {
				ll gg;
				gg=acu[aux[j]][k];
				if (k) gg-=acu[aux[j]][k-1];
				if (ant!=-1) gg-=acu[ant][k];
				if (ant!=-1 && k) gg+=acu[ant][k-1];
				G[j].pb(gg);
			}
			ant=aux[j];
		}
		int back=-1;
		bool t=true;
		for (int k=0;k<sz(aux);k++) {
			for (int j=0;j<w;j++) if (G[k][j]>kk) t=false;
		}
		if (t) {
			int c=0;
			int we[N];
			for (int k=0;k<sz(aux);k++) we[k]=0;
			for (int j=0;j<w;j++) {
				for (int k=0;k<sz(aux);k++) we[k]+=G[k][j];
				bool rt=false;
				for (int k=0;k<sz(aux);k++) if (we[k]>kk) rt=true;
				if (rt) {
					c++;
					for (int k=0;k<sz(aux);k++) we[k]=G[k][j];
				}
			}
			if (c+yup<res) {
				res=c+yup;
			}
		}
	}
	cout<<res-1;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define scf scanf
#define ptf printf
#define forp(i,j,k) for(int i=j;i<k;i++)
#define form(i,j,k) for(int i=j;i>k;i--)
#define sz(x) (int)x.size()
#define pb push_back
#define fst first
#define scd second
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

char str[100];
int hh[2000],mn[2000],sum[2000],num_a,a[10],in[2000];

struct node
{
    int a,b,x,y;
    node(){}
    node(int _a,int _b,int _x,int _y)
    {
        a=_a;
        b=_b;
        x=_x;
        y=_y;
    }
};

vector<node>lis[1010];

char strtonum(char*s)
{
    char res;
    num_a=0;
    int t0;
    for(int i=0;s[i];)
    {
        if(s[i]<'0'||s[i]>'9')
        {
            if(s[i]=='I'||s[i]=='O')res=s[i];
            i++;
            continue;
        }
        t0=0;
        for(;s[i]>='0'&&s[i]<='9';i++)
            t0=t0*10+(s[i]-'0');
        a[num_a++]=t0;
    }
    return res;
}

int main()
{
    int n;
    for(scf("%d",&n);n;scf("%d",&n))
    {
        memset(sum,0,sizeof(sum));
        gets(str);
        forp(i,0,1001)lis[i].clear();
        forp(i,0,n)
        {
            gets(str);
            if(strtonum(str)=='I')
                in[a[4]]=a[2]*60+a[3];
            else
                lis[a[4]].pb(node(a[0],a[1],in[a[4]],a[2]*60+a[3]));
        }
        forp(i,0,sz(lis[0]))
        {
            forp(j,1,1001)
                forp(k,0,sz(lis[j]))
                    if(lis[j][k].a==lis[0][i].a&&lis[j][k].b==lis[0][i].b&&lis[j][k].x<=lis[0][i].y&&lis[j][k].y>=lis[0][i].x)
                        sum[j]+=min(lis[0][i].y,lis[j][k].y)-max(lis[0][i].x,lis[j][k].x);
        }
        int ans=-1;
        forp(i,1,1001)
            ans=max(ans,sum[i]);
        ptf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1272
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N, K;
    scan(N, K);
    auto P = aryread();
    P.sort();
    P[0 .. K].sum().writeln();
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
  int a, b;
  cin >> a >> b;
  vector<int> N(3);
  N[0] = a + b;
  N[1] = a - b;
  N[2] = a * b;
  sort(N.begin(), N.end());
  cout << N[2] << endl;
}


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

A = list(map(int,input().split()))
#print(A)
count = 0
flag = 0
while True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] /= 2
        else:
            flag = 1
            break
    if flag:
        break
    count += 1
print(count)


Measured memory_bytes: 3188
from math import gcd
from collections import Counter
N, *A = map(int, open(0).read().split())
*A, = zip(*[iter(A)]*2)

mod = 10**9 + 7


def modpow(a, n, mod):
    ret = 1
    while n:
        if n & 1:
            ret = ret * a % mod
        a = a * a % mod
        n >>= 1
    return ret

col = []
row = []
zero = 0
for a, b in A:
    if a == b == 0:
        zero += 1
        continue
    if a == 0:
        col.append((1,0))
        continue
    elif b == 0:
        row.append((1,0))
        continue
    else:
        g = gcd(abs(a), abs(b))
        a //= g
        b //= g

    if a < 0:
        a *= -1
        b *= -1

    if b > 0:
        col.append((a, b))
    elif b < 0:
        row.append((-b, a))

C = Counter(col)
D = Counter(row)
S = set(col) | set(row)

ans = 1
for s in S:
    if s in C:
        if s in D:
            mul = modpow(2, C[s], mod) + modpow(2, D[s], mod) - 1
            mul %= mod
        else:
            mul = modpow(2, C[s], mod)
    elif s in D:
        mul = modpow(2, D[s], mod)

    ans *= mul
    ans %= mod

ans -= 1
ans += zero
ans %= mod

print(ans)


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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int x, y;
	cin >> x >> y;
	if (y % 2 == 0) {
		if (1.0 * y / x >= 2 and 1.0 * y / x <= 4) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No";
}

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

int main(){
  	int n;
  	cin >> n;
  	if(n==1) {
    	cout << "Hello World";
      	return 0;
    }
  	int a,b;
  	cin >>a >> b;
  	cout << a+b;
  	
	return 0;
}

Measured memory_bytes: 256
import sys
input= sys.stdin.readline

N = int(input())

li = [1,2,3,4,5,6,7,8,9]
ans = []
for i in range(len(li)):
    p = N % li[i]
    q = N // li[i]
    if (p==0):
        ans.append(q)

ansflag = False
if (len(ans)!=0):
    for i in ans:
        if (i in li):
            ansflag = True
            break
        else:
            continue

if ansflag:
    print('Yes')
else:
    print('No')

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




int main(){
    int A,B,C;cin >> A>> B >> C;
    if(A <= C && C <= B){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(B <= C && C <= A){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}


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

int main() {
	int r;
  	cin >> r;
  if(r < 1200){
    cout << "ABC" << endl;
  }else if( r >= 1200 && r < 2800){
    cout << "ARC" << endl;
  }else if(r >= 2800){
    cout << "AGC" << endl;
  }
}


Measured memory_bytes: 256
N, D = map(int, input().split())
X = []
for n in range(N):
  X.append(list(map(int, input().split())))

def check_dist(i, j):
  quad = sum([(xi - xj) * (xi - xj) for xi,xj in zip(X[i], X[j])])
  dist = 1
  while dist * dist <= quad:
    if dist * dist == quad:
      return True
    dist += 1
  return False

count = 0
for i in range(N-1):
  for j in range(i+1, N):
    count += check_dist(i, j)
print(count)

Measured memory_bytes: 62996
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC122B
{
    static class MainClass
    {



        public static void Main(string[] args)
        {

            string s = Console.ReadLine();
            int n = s.Length;
            var anslst = new List<int>();
            anslst.Add(0);
            for (int i = 0; i < n; i++)
            {

                for (int j = 1; j <= n - i; j++)
                {
                    int tmp = 0;
                    for (int k = 0; k < j; k++)
                    {
                        if (s[i + k] == 'A' || s[i + k] == 'T' || s[i + k] == 'G' || s[i + k] == 'C')
                        {

                        }
                        else
                        {
                            tmp = 1;
                        }

                        if (k == j-1 && tmp == 0)
                        {

                            anslst.Add(j);
                        }
                    }
                }

            }
            anslst.Sort();
            Console.WriteLine(anslst.Last());
        }
    }
}


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

typedef vector<int> vi;
typedef bitset<18> MASK;

#define ll long long
#define PI 3.14159265359
//#define x first
//#define y second
#define point pair<int,int>
#define clr(x, val)	memset((x), (val), sizeof(x))

//you don't know math, unless you can do math!
vector<int> num;
int dp[10009][100][2];
int md = 1e9 + 7;
int d;

int solve(int i, int mod, int smaller){
    if(i == num.size())
        return (mod == 0);

    int &ret = dp[i][mod][smaller];
    if(ret != -1)
        return ret;

    int mx;
    if(smaller)
        mx = 9;
    else
        mx = num[i];

    ret = 0;
    for(int k = 0; k <= mx; k++){
        ret += solve(i + 1, (mod + k)%d, smaller || (k < mx));
        ret %= md;
    }

    return ret;
}

int solve1(string s){
    num.clear();
    for(int i = 0; i < s.length(); i++)
        num.push_back(s[i] - '0');

    clr(dp, -1);
    return solve(0, 0, 0);
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    string h; cin>>h;
    cin>>d;

    cout<<(solve1(h) - 1 + md)%md;
}


Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace::std;
using ll = long long;
int main() {
    int A,B,K; cin >> A >> B >> K;
    int cnt = 0;
    for (int i=max(A,B);i>=1;i--){
        if (A%i==0 && B%i==0) cnt++;
        if (cnt==K){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

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

typedef long long ll;

int main(){
    ll x,y,z,k;
    cin >> x >> y >> z >> k;
    ll a[x];
    ll b[y];
    ll c[z];
    for(int i=0;i<x;i++) cin >> a[i];
    for(int j=0;j<y;j++) cin >> b[j];
    for(int s=0;s<z;s++) cin >> c[s];
    vector<ll> res;
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            res.push_back(a[i]+b[j]);
        }
    }
    sort(res.begin(),res.end(),greater<ll>());
    sort(c,c+z,greater<ll>());
    vector<ll> ans;
    for(int i=0;i<min(k,x*y);i++){
        for(int j=0;j<min(k,z);j++){
            ans.push_back(res[i]+c[j]);
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>());
    for(int i=0;i<k;i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 43364
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

/*
・全体集合を2個に分けて，SとTを作るとき，Sだけを考えればいいことが多い．
今回は特にSを決めるとTが一意に定まり，また，S-Tも自明に一意に定まる

・今回問題文敵にどう考えても等差数列であることを活かすしかないんだから
それを考慮した式変形をする
aX+bD
a=3の時，b=[0+1+2,(n-1)+(n-2)+(n-3)]
mod DごとのXのrangeがわかる
*/

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n,x,d;cin>>n>>x>>d;
    if(d==0){
        if(x==0) cout<<1<<endl;
        else cout<<n+1<<endl;
        return 0;
    }
    if(d<0) d=-d,x=-x;
    map<ll,vector<ll>> lv,rv;
    for(ll i=0;i<=n;i++){
        ll dm=i*x%d;
        ll pl=i*x/d;
        ll l=i*(i-1)/2+pl;
        ll r=(2*n-i-1)*i/2+pl;

        lv[dm].push_back(l);
        rv[dm].push_back(r);
    }

    ll ans=0;
    for(auto &p:lv){
        vector<pair<ll,ll>> v;
        rep(i,p.second.size()) v.push_back({p.second[i],rv[p.first][i]});

        sort(ALL(v));

        ll pr=-LINF;
        for(auto lr:v){
            ans+=max(0ll,lr.second-max(pr+1,lr.first)+1);
            chmax(pr,lr.second);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 47336
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define M 25
int A[M][M];
int pf(int x){
	return x*x;
}
bool check(LL x){
	LL p=(LL)sqrt(x);
	return p*p==x;
}
int main(){
	int ans=0,n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>A[i][j];
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			LL res=0;
			for(int k=1;k<=m;k++)
				res+=pf(A[i][k]-A[j][k]);
			ans+=check(res);
		}
	cout<<ans;
	return 0;
}

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

#define f first
#define s second
#define ll long long
#define pb push_back
#define mp make_pair
#define inp(x) cin>>x
#define print(x) cout<<x
#define pii pair<int,int>
#define pll pair<ll,ll>
#define gcd(a,b) __gcd(a,b)
#define reset(d,val) memset(d,val,sizeof(d))
#define sort(v) sort(v.begin(),v.end())
#define sort_arr(arr,i,f) sort(arr+i,arr+f)
#define pq priority_queue<int,vector<int>,greater<int> >
#define pq1 priority_queue<pll,vector<pll>,greater<pll> >
#define ld long double

const int mod = 1e9+7;



int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ld a,b,h,m;
	cin>>a>>b>>h>>m;
	ld mha = (h*60+m)*6;
	ld hha = (h*60+m)*0.5;
	ld dif = abs(mha-hha);
	ld x = a*a + b*b - 2*a*b*cos((dif*M_PI)/180);
	x=sqrt(x);
	printf("%.18Lf\n", x);
	return 0;
}


Measured memory_bytes: 4116
import copy
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
a=max(A)
b=A.index(a)
for j in range(N):
    if j!=b:
        print(a)
    else:
        B=copy.copy(A)
        C=B.pop(j)
        print(max(B))

Measured memory_bytes: 14560
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define min3(a,b,c) min(min(a,b),c)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
std::vector<ll> v[3];
ll n;
int memo[100005][3];
ll dp(ll i, ll last)
{
	// cout << i << endl;
	if (i == n)
		return 0;
	if (memo[i][last] != -1)
		return memo[i][last];
	if (last == 0)
		return memo[i][last]=max(v[1][i] + dp(i + 1, 1), v[2][i] + dp(i + 1, 2));
	if (last == 1)
		return memo[i][last]=max(v[0][i] + dp(i + 1, 0), v[2][i] + dp(i + 1, 2));
	return memo[i][last]=max(v[1][i] + dp(i + 1, 1), v[0][i] + dp(i + 1, 0));

}
void solve()
{
	memset(memo, -1, sizeof(memo));
	cin >> n;
	rep(i, n)
	{
		ll x, y, z;
		cin >> x >> y >> z;
		v[0].pb(x);
		v[1].pb(y);
		v[2].pb(z);
	}
	reverse(entire(v[0]));
	reverse(entire(v[1]));
	reverse(entire(v[2]));
	cout << max(max(dp(0, 0), dp(0, 1)), dp(0, 2)) << endl 	;

}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 11464
fn main() {
    let nq = read_vec::<usize>();
    let n = nq[0];
    let q = nq[1];
    let mut graph: Vec<Vec<usize>> = vec![Vec::new(); n];
    for _ in 0..n - 1 {
        let ab = read_vec::<usize>();
        let a = ab[0] - 1;
        let b = ab[1] - 1;
        graph[a].push(b);
        graph[b].push(a);
    }

    let mut score: Vec<usize> = vec![0; n];
    for _ in 0..q {
        let px = read_vec::<usize>();
        let p = px[0] - 1;
        let x = px[1];
        score[p] += x;
    }
    dfs(0, 0, &mut score, &graph);

    for i in 0..n {
        print!("{} ", score[i]);
    }
    println!("");
}

fn dfs(cur: usize, par: usize, score: &mut Vec<usize>, graph: &Vec<Vec<usize>>) {
    for child in graph[cur].iter() {
        if *child == par {
            continue;
        }
        score[*child] += score[cur];
        dfs(*child, cur, score, graph);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 27572
import sys

def main():
    input = sys.stdin.readline
    K, X = map(int, input().split())
    ans = []
    start = X - K + 1
    end = X + K
    for i in range(start, end):
        ans.append(i)

    return ' '.join(map(str, ans))


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 80; 
const ll MOD = 1e9 + 7;
struct matrix
{
  int n, m;
  ll v[MAXN][MAXN];
 
  matrix(int n = 0, int m = 0) : n(n), m(m)
    { memset( v , 0 , sizeof(v) ); }
 
  void init(int N, int M) { n = N; m = M; }
 
  matrix operator * (matrix a)
  {
    matrix ans( n , a.m );
 
    for(int i = 1 ; i <= n ; i++)
    {
      for(int j = 1 ; j <= a.m ; j++)
      {
        for(int k = 1 ; k <= m ; k++)
        {
          ans.v[i][j] += v[i][k]*a.v[k][j];
          ans.v[i][j] %= MOD;
        }
      }
    }
 
    return ans;
  }
};

matrix T;
int n;
matrix fexp(ll k){
	matrix ans = matrix(n,n);

	for(int i = 1; i <= n; i++) ans.v[i][i] = 1;

	for(ll i = 60; i >= 0; i--){
		ans = ans*ans;
		if(k&(1LL<<i)){
			// printf("%lld\n",(ll)(1<<i) ); 
			// for(int i = 1; i <= n; i++){
			// 	for(int j = 1; j <= n; j++){
			// 		printf("%lld ", ans.v[i][j]);
			// 	}
			// 	printf("\n");
			// }
			// for(int i = 1; i <= n; i++){
			// 	for(int j = 1; j <= n; j++){
			// 		printf("%lld ", T.v[i][j]);
			// 	}
			// 	printf("\n");
			// }
			ans = ans*T;
			
		}
	}
	return ans;
}
ll k = 0;
int main(){
	scanf("%d %lld", &n, &k);
	T = matrix(n,n);
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			scanf("%lld", &T.v[i][j]);
		}
	}
	//printf("%lld\n", k);
	matrix a = fexp(k);
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			//printf("%lld ", a.v[i][j]);
			ans += a.v[i][j];
			ans%=MOD;
		}
		//printf("\n");
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int area = a*b;
  int length = (a+b)*2;
  System.out.println(area +" "+length);
 }
}

Measured memory_bytes: 26092
N = int(input())
list_num = [int(_) for _ in input().split(" ")]

product = 1

if 0 in list_num:
    print(0)
else:
    checker = True
    for i, num in enumerate(list_num):
        product *= num
        if product > 10**18:
            checker = False
            break
        
    if checker:
        print(product)
    else:
        print(-1)

Measured memory_bytes: 21584
#include <stdio.h>
#define MAX_NUM 100000

int CC[MAX_NUM] = {0};

void init() {
  int i;
  for (i = 0; i < MAX_NUM; ++i) {
    CC[i] = i;
  }
}

int find(int a) {
  if (a == CC[a]) {
    return a;
  }

  return CC[a] = find(CC[a]);
}

int isSame(int a, int b) {
  if (find(a) == find(b)) {
    return 1;
  }
  else {
    return 0;
  }
}

void unite(int a, int b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  CC[b] = a;
}

int main() {
  int n, m, q, i, j, k;
  init();
  scanf("%d %d", &n, &m);
  for ( i = 0; i < m; ++i ) {
    scanf("%d %d", &j, &k);
    unite(j, k);
  }
  scanf("%d", &q);

  for ( i = 0; i < q; i++ ) {
    scanf("%d %d", &j, &k);
    if (isSame(j, k)) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }

  return 0;
}



Measured memory_bytes: 2096
from collections import Counter
N = int(input())
d = list(map(int, input().split()))

MOD = 998244353

dn = Counter(d)
ans = 1
if dn[0] != 1 or d[0] != 0: ans = 0
else:
    for i in range(1, max(d)+1):
        ans *= (dn[i-1]**dn[i])
        ans %= MOD
    
print(ans)

Measured memory_bytes: 19936
#include <iostream>

using namespace std;

int main(){
    string W;
    string T;
    cin >> W;
    int wc = 0;
    while(1){
        cin >> T;
        if(T == "END_OF_TEXT") break;
        for(int i = 0; i < T.size(); i++){
            if(T[i] >= 'A' && T[i] <= 'Z') T[i] += 'a' - 'A';
        }
        if(T.find(W) != -1 && T.size() == W.size()) wc++;
    }
    cout << wc << endl;

    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
	int n,k;
  	cin>>n>>k;
  	vector <int> v(n);
  	int dp[n+k+1];
	for (auto &it:v)
      cin>>it;
  	dp[0]=0;
  	dp[1]=abs(v[0]-v[1]);
  	for (int i=2;i<n;++i)
    {
      	int ans=INT_MAX;
      for (int j=k;j>=1;--j)
      {
        if (i-j>=0)
    		ans=min(ans,dp[i-j]+abs(v[i-j]-v[i]));
      }
      dp[i]=ans;
    }
  	cout<<dp[n-1]<<endl;
}

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

string to_string(string s) { return '"' + s + '"'; }
string to_string(char c) { string s = "'"; s += c; return s + "'"; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } 
template <typename A>
string to_string(A v) {
    bool first = true; 
    string res = "{";
    for (const auto &x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}"; 
    return res;
}
istream_iterator<string> eos;
void dbg_out(istream_iterator<string> it) { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(istream_iterator<string> it, Head H, Tail... T) {
    cerr << *it << " = " << to_string(H);
    if(++it != eos) cerr << ", ";
    dbg_out(it, T...);
}
#ifdef LOCAL
    #define dbg(...) { string _s = #__VA_ARGS__; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); dbg_out(_it, __VA_ARGS__); }
#else
    #define dbg(...)
#endif

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define MP make_pair
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    cout << fixed << setprecision(10);
    long double l, sd, last;
    cin >> l;
    sd = l/3.0;
    last = l - (sd + sd);
    cout << sd * sd * last << nl;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define popb pop_back
# define pf push_front
# define popf pop_front
# define sll set<ll>
# define schar set<char>
//find()
//erase(x) removes element x
//erase(position,position)
# define qll queue<ll>
# define qstr queue<str>
//front(),back()
# define stll stack<ll>
# define ststr stack<str>
//top()
# define dll deque<ll>
//at()
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define mss map<str,str>
# define mci map<char,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define fr(x,y,z) for(int x=y;x<z;x++)
# define rr(x,y,z) for(int x=y;x>z;x--)
ll power(ll a , ll b){ll res=1;for(ll i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    double x;
    cin>>x;
    cout<<2*pi*x;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    char s[101]={};
    scanf("%s",s);
    int k=strlen(s);
    for(int i=0;i<k;i++)
    {
        s[i]=tolower(s[i]);
    }
    if(k<=n)
       cout<<s<<endl;
    else if(k>n){
      for(int i=0;i<n;i++){
        printf("%c",s[i]);}
        cout<<"..."<<endl;
    }
 
    return 0;
}

Measured memory_bytes: 3664
/*　反省点としては、if文とelse文とreturn文についての順番

if
if 
else と並べてしまったときには、else文というのは上のifにしか効力を持たないので予期せぬ
バグが起こる可能性がある。配列indexなどを機にするDPではこれに注意しよう
[配列のindexerrorが起きた場合、何も生じされない]
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define big 1000000007
vector<int> data1;
vector<int> memo(200000);
vector<int> done(200000);
ll dp(int n)
{
    if (done[n] == 1)
    {
        return memo[n];
    }
    else
    {
        ll res;
        if (n == 0)
        {
            return 0;
        }
        if (n == 1)
        {
            res = labs(data1[n] - data1[n - 1]);
            return res;
        }

        else
        {
            res = min(labs(data1[n] - data1[n - 1]) + dp(n - 1), labs(data1[n] - data1[n - 2]) + dp(n - 2));
        }
        done[n] = 1;
        memo[n] = res;
        return res;
    }
}
int main()
{
    ll n;
    cin >> n;
    data1.resize(n);
    rep(i, n)
    {
        cin >> data1[i];
        //  cout << data[i];
    }
    // cout << dp(n - 1); //その場所まで行くのにかかる最小コスト
    cout << dp(n - 1);
}

Measured memory_bytes: 4480
n,m = map(int,input().split())
a = [0]*n
ac = 0
wa = 0
for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s == "AC" and a[p-1] != -1:
        ac +=1
        wa += a[p-1]
        a[p-1] = -1
    elif s == "WA" and a[p-1] != -1:
        a[p-1] += 1
print(ac,wa)



Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define Maxn 200007
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,a[Maxn],ans[Maxn];
int main()
{
	n=read();
	for (int i=1;i<=n;i++)
		a[i]=read();
	int lx=0,rx=n+1;
	for (int i=n;i;i--)
	{
		if ((n-i)%2==0) ans[++lx]=a[i]; else ans[--rx]=a[i];
	}
	for (int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 3712
s = list(input())
s_re = list(reversed(s))
n = len(s)
s2 = [s[i] for i in range((n-1)//2 )]
s2_re = list(reversed(s2))
s3 = [s[i] for i in range((n+3)//2 - 1,n)]
s3_re = list(reversed(s3))
if (s == s_re) and (s2 == s2_re) and (s3 == s3_re):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064