akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int n;
vvi maze;
vi seen;
vi dTaka;
vi dAo;

void dfs(int x,int length,vi &d) {
  int sz = maze.at(x).size();
  seen.at(x) = 1;
  d.at(x) = min(length,d.at(x));
  rep(i,sz) {
    int nx = maze.at(x).at(i);
    if(!seen.at(nx)) dfs(nx,length+1,d);
  }
}
const int INF = 100100101;

int main() {

  cin >> n;
  int taka,ao;cin >> taka >> ao;
  taka--;ao--;
  maze = vvi(n,vi());

  int m = n-1;
  rep(i,m) {
    int a,b;cin >> a >> b;
    a--;b--;
    maze.at(a).eb(b);
    maze.at(b).eb(a);
  }

seen = vi(n,0);
  dTaka = vi(n,INF);
  dfs(taka,0,dTaka);
  seen = vi(n,0);
  dAo = vi(n,INF);
  dfs(ao,0,dAo);

  int ans = 0;
  rep(i,n) {
    if(dTaka.at(i) < dAo.at(i)) ans = max(ans,dAo.at(i)-1);
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 16424
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,x;
  cin >> a;
  cin >> b;
  x = a+b;
  if(x%2){
    cout << (x+1)/2 << endl;
  } else {
    cout << x/2 << endl;
  }
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1, q = 0;
    // cin >> t;
    while (t--) {
        // cout << "Case #" << ++q << ": ";
        int k, a, b;
        cin >> k >> a >> b;
        string ans = "NG";
        while (a <= b) {
            if (a % k == 0) {
                ans = "OK";
                break;
            }
            a++;
        }
        cout << ans;
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
N = int(input())
A = [int(input()) for _ in range(N)]

A.sort()
if N % 2 == 0:
    print(-2*sum(A[:N//2-1]) - A[N//2-1] + A[N//2] + 2*sum(A[N//2+1:]))
else:
    print(-2*sum(A[:N//2-1])
          + max(-2*A[N//2-1] + A[N//2] + A[N//2+1], - A[N//2-1] - A[N//2] + 2*A[N//2+1])
          + 2*sum(A[N//2+2:]))

Measured memory_bytes: 7512
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int min = 99999;
		int max = 0;
		for(var i=0;i<str.Length;i++){
			int a = int.Parse(str[i]);
			min = Math.Min(min,a);
			max = Math.Max(max,a);
		}
		Console.WriteLine(max-min);
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {

	int n, m;
	cin >> n >> m;

	vector< vector<int> > dp(n, vector<int>(n, 0));

	vector<int> a(m);
	vector<int> b(m);

	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		dp[a[i]][b[i]] = dp[b[i]][a[i]] = 1;
	}
	int count = 0;

	for (int i = 0; i < m; i++) {
		vector< vector<int> > dp2 = dp;
		dp2[a[i]][b[i]] = dp2[b[i]][a[i]] = 0;
		vector<int> cc(m, 0);
		cc[0] = 1;
		int sum = 1;
		queue<int> q;
		q.push(0);
		while (!q.empty()) {
			int pp = q.front();
			q.pop();
			for (int j = 0; j < n; j++) {
				if (dp2[pp][j] == 1) {
					if (cc[j] == 0) {
						cc[j] = 1;
						q.push(j);
						sum++;
					}
				}
			}
		}
		if (sum != n) {
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct Node {
    int key;
    Node *prev,*next;
};
Node *nil;
void init() {
    nil=(Node *)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
}
Node * listSearch(int key) {
    Node *cur=nil->next;//从头节点后面的元素开始访问
    while(cur!=nil&&cur->key!=key) {
        cur=cur->next;
    }
    return cur;
}
void printList() {
    Node *cur=nil->next;
    int isf=0;
    while(1) {
        if(cur==nil) break;
        if(isf++>0) printf(" ");
        printf("%d",cur->key);
        cur=cur->next;
    }
    printf("\n");
}
void deleteNode(Node *t) {
    if(t==nil) return ;//t为头结点时不做处理
    t->prev->next=t->next;
    t->next->prev=t->prev;
    free(t);
}
void deleteFirst() {
    deleteNode(nil->next);
}
void deleteLast() {
    deleteNode(nil->prev);
}
void deleteKey(int key){
    deleteNode(listSearch(key));
}
void insert(int key){
    Node *x=(Node *)malloc(sizeof(Node));
    x->key=key;
    //在头节点后添加元素
    x->next=nil->next;
    x->next->prev=x;
    nil->next=x;
    x->prev=nil;
}
int main() {
    char c[20];
    int n,num;
    init();
    scanf("%d",&n);
    while(n--){
        scanf("%s",c);
        if(c[0]=='i') {scanf("%d",&num);insert(num);}
        else if(c[6]=='F') deleteFirst();
        else if(c[6]=='L') deleteLast();
        else if(c[0]=='d'){
            scanf("%d",&num);
            deleteKey(num);
        }
    }
    printList();
}



Measured memory_bytes: 34452
/*
ID: jerrywcy
LINK:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

ll n,m,v,p;
ll a[100010];
ll s[100010];
// int b[100010];

ll read(){
    ll f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

bool cmp(ll x,ll y){return x>y;}

bool ck(int x){
    if (a[x]+m<a[p])return 0;
    ll cnt=(p-1)*m+(n-x+1)*m;
    for (int i=p;i<x;i++){
        cnt+=a[x]+m-a[i];
    }
    return cnt>=m*v;
}

int main()
{
//	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	n=read();m=read();v=read();p=read();
	for (int i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i++)s[i]=s[i-1]+a[i];
	ll l=p+1,r=n,mid,ans=p;
	while (l<=r){
		mid=l+r>>1;
		// cout<<mid<<endl;
		if (ck(mid)){
			l=mid+1;
			ans=max(ans,mid);
			// cout<<"1\n";
		}
		else {
			r=mid-1;
			// cout<<"0\n";
		}
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1792
import sys

diff = []

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

if N >= M:
    print(0)
    exit()

X.sort()

for i in range(len(X)-1):
    diff.append(X[i+1]-X[i])

diff.sort()

for i in range(N-1):
    diff.pop()

print(sum(diff))


Measured memory_bytes: 13968
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin >>a>>b>>c;
  int flag1=0,flag2=0,flag3=0; 
  if(a==b)
  flag1=1;
  if(a==c)
  flag2=1;
  if(b==c)
  flag3=1;
  if(flag1&&flag2&&flag3)
  cout<<"Yes";
  else
  cout<<"No";
  return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b, c;
	cin >> a >> b >> c;

	if (a == b + c || b == a + c || c == a + b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

int n, K;

int compress(vector<int>& v1, vector<int>& v2, vector<int>& ret)
{
	vector<int> vs;
	for (int i = 0; i < n; i++)
	{
		vs.push_back(v1[i]);
		vs.push_back(v2[i]);
	}
	sort(vs.begin(), vs.end());
	vs.erase(unique(vs.begin(), vs.end()), vs.end());

	for (int i = 0; i < n; i++)
	{
		v1[i] = find(vs.begin(), vs.end(), v1[i]) - vs.begin();
		v2[i] = find(vs.begin(), vs.end(), v2[i]) - vs.begin();
 	}
	ret = vs;
	return vs.size();
}

int main(void)
{
	while(cin >> n >> K && n && K)
	{
		vector<int> x1(n), y1(n), d1(n), x2(n), y2(n), d2(n);
		vector<int> rx, ry, rd;
		for (int i = 0; i < n; i++)
		{
			cin >> x1[i] >> y1[i] >> d1[i] >> x2[i] >> y2[i] >> d2[i];
		}

		int xc = compress(x1, x2, rx);
		int yc = compress(y1, y2, ry);
		int dc = compress(d1, d2, rd);

		long long ans = 0;
		for (int d = 0; d + 1 < dc; d++)
		{
			for (int y = 0; y + 1 < yc; y++)
			{
				for (int x = 0; x + 1 < xc; x++)
				{
					int count = 0;
					for (int i = 0; i < n; i++)
					{
						if(x1[i] <= x && x < x2[i]
							&& y1[i] <= y && y < y2[i]
							&& d1[i] <= d && d < d2[i])
							count++;
					}
					if(count >= K)
						ans += (long long)(rx[x+1] - rx[x]) * (long long)(ry[y+1] - ry[y]) * (long long)(rd[d+1] - rd[d]);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include <cstdio>
#include <algorithm>

int main(void){
    int i,n,tmp,sum=0;
    int v[20];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",v+i);
    }
    for(i=0;i<n;i++){
        scanf("%d",&tmp);
        sum+=std::max(0,v[i]-tmp);
    }
    printf("%d\n",sum);
    return 0;
}


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

int main(){
	int n,k,x,y;
	int sum;
	cin >> n >> k >> x >> y;

	sum = 0;
	if (n >= k)	{
		sum += k * x;
		sum += (n - k) * y; 
	} else {
		sum = n * x;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
using namespace std;
typedef long long int LLI;
int sum_of_digits(int x)
{
	int sum = 0;
	while( x > 0 )
	{
		sum += x % 10;
		x /= 10;
	}
	return sum;
}
int main()
{
	int n, a, b, tmp;
	LLI ans = 0;
	cin >> n >> a >> b;
	for(int i = 1; i <= n; i++)
	{
		tmp = sum_of_digits(i);
		if( a <= tmp and tmp <= b )
			ans += i;
	}
	cout << ans;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m, p; cin >> n >> m >> p;
  vector<int> us, vs, ws;
  rep(i, m) {
    int a, b, c; cin >> a >> b >> c; a--; b--;
    us.push_back(a);
    vs.push_back(b);
    ws.push_back(c - p);
  }
  const ll inf = 1e18;
  vector<ll> dist(n, -inf);
  dist[0] = 0;
  rep(i, n*4) {
    rep(j, us.size()) {
      if (dist[us[j]] != -inf)
        dist[vs[j]] = max(dist[vs[j]], dist[us[j]] + ws[j]);
    }
  }
  ll ans = dist[n - 1];
  rep(i, n*4) {
    rep(j, us.size()) {
      if (dist[us[j]] != -inf)
        dist[vs[j]] = max(dist[vs[j]], dist[us[j]] + ws[j]);
    }
  }
  if (ans != dist[n - 1]) {
    cout << -1 << endl;
  } else {
    cout << max(0LL, ans) << endl;
  }
}

Measured memory_bytes: 384
function main(input){
  input = input.split(' ').map(parseFloat);
  
  if(input[0] >= 10 || input[1] >= 10){
    console.log(-1);
    return;
  }
  
  console.log(input.reduce((arr,cur) => arr * cur)); 
}

main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
let [| w; h; x; y|] = stdin.ReadLine().Split() |> Array.map int64 

let hasPlural =
    match w % 2L, h % 2L with
    |1L,_ | _, 1L -> 0
    | _ ,_ ->
        match (x,y) = (w/2L, h/2L) with
        |false -> 0
        |true -> 1

w * h |> float |> fun x -> x / 2.0 |>fun x -> string x + " " + string hasPlural
|> stdout.WriteLine

Measured memory_bytes: 13268
n =int(input())

s = []

for _ in range(n):
    s.append(input())

dictionary = {}

for i in s:
    if i in dictionary:
        dictionary[i] += 1
    else:
        dictionary[i] = 0

max_val = max(dictionary.values())
keys_of_max_val = []

for key in dictionary:
    if dictionary[key] == max_val:
        keys_of_max_val.append(key)

keys_of_max_val.sort()

for ans in keys_of_max_val:
    print(ans)

Measured memory_bytes: 35220
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 3e18
#define ULMAX 18446744073709551615
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define deb1(x) cout << #x <<"="<< x <<endl;
#define deb2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define deb3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define deb4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define debarr(x) cout << #x<<"::"<<endl;for(int i : x){cout << i <<" ";} cout <<endl;

inline int add(int a, int b){a = (a+b); if(a>=mod)a-=mod; return a;}
inline int sub(int a, int b){a = a-b; if(a<0)a+=mod; return a;}
inline int mul(int a, int b){a = (a*b)%mod; return a;}



void mymain(){
  int n,k;
  cin >> n >> k;
  vi arr(n+1);
  //for(int& i : arr) cin >> i;
  for(int i=1;i<=n;i++)
    cin >> arr[i];
  map<int,int> occ;
  vi path;
  int cur = 1;
  path.pb(1);
  while(1){
    cur = path.back();
    int nxt = arr[cur];
    if(occ.count(nxt) == 0){
        path.pb(nxt);
        occ[nxt] = path.size()-1;
    }else{
        cur = nxt;
        break;
    }
  }
  int idx = occ[cur];
  if(k <= idx){
        cout << path[k] <<endl;
        return;
  }
  k -= idx;
  vi lp;
  while(idx < path.size())
    lp.pb(path[idx++]);

  cout << lp[k%lp.size()] <<endl;

}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;

for(int tt=0;tt<t;tt++){
   //cout << "Case #" << tt+1 <<": ";
   mymain();
}
return 0;
}
/*

*/


Measured memory_bytes: 19052
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
int n,ai[6];
ll dp[6][4];
int main()
{
	std::cin>>n;
	char op[15];
	for(int i=1;i<=n;i++)
	{
		scanf("%s",op);
		if(op[0]=='M')
			ai[1]++;
		if(op[0]=='A')
			ai[2]++;
		if(op[0]=='R')
			ai[3]++;
		if(op[0]=='C')
			ai[4]++;
		if(op[0]=='H')
			ai[5]++;
	}
	dp[0][0]=1;
	for(int i=1;i<=5;i++)
	{
		dp[i][0]=dp[i-1][0];
		for(int v=1;v<=3;v++)
			dp[i][v]=dp[i-1][v-1]*ai[i]+dp[i-1][v];
	}
	std::cout<<dp[5][3]<<std::endl;
	return 0;
}

Measured memory_bytes: 256
w,h,n=map(int,input().split())
grid=[[0 for i in range(w)] for j in range(h)]
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        for i in range(x):
            for j in range(h):
                grid[j][i]=1
    if a==2:
        for i in range(x,w):
            for j in range(h):
                grid[j][i]=1
    if a==3:
        for i in range(w):
            for j in range(y):
                grid[j][i]=1
    if a==4:
        for i in range(w):
            for j in range(y,h):
                grid[j][i]=1
res = 0
for i in grid:
    for j in i:
        if j==0:
            res += 1
print(res)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#define int long long 
using namespace std;
int dp[101][100001],w[101],v[101],sum[101],n,W;
signed main()
{
	scanf("%lld%lld",&n,&W);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&w[i],&v[i]);
		sum[i]=sum[i-1]+v[i];
	}
	memset(dp,0x7f7f7f7f,sizeof(dp));
	for(int i=0;i<=n;i++)
		dp[i][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=sum[i];j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j>=v[i])
			{
				dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
			}
		} 
	}
	for(int i=sum[n];i>=0;i--)
	{
		if(dp[n][i]<=W)
		{
			cout<<i;
			return 0;
		}
	}
}



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

int main()
{
    int a[3][3];
    rep(i, sizeof(a)/sizeof(a[0])) cin >> a[i][0] >> a[i][1] >> a[i][2];
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n) cin >> b[i];
    rep(i, n) {
        rep(j, sizeof(a)/sizeof(a[0])) {
            if (b[i] == a[j][0]) a[j][0] = 0;
            else if (b[i] == a[j][1]) a[j][1] = 0;
            else if (b[i] == a[j][2]) a[j][2] = 0;
        }
    }
    if (a[0][0] == a[1][1] && a[1][1] == a[2][2]) {
        cout << "Yes" << endl;
        return 0;
    }
    else if (a[0][2] == a[1][1] && a[1][1] == a[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }
    rep(i, sizeof(a)/sizeof(a[0])) {
        if (a[i][0] == a[i][1] && a[i][1] == a[i][2]) {
            cout << "Yes" << endl;
            return 0;
        }
        else if (a[0][i] == a[1][i] && a[1][i] == a[2][i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#define N 
#define mod
#define inf
#define rg register
using namespace std;
typedef long long ll;
int main(){
	int n,m;
	scanf ("%d%d",&n,&m);
	int ans=(n-1)*(m-1);
	printf ("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()+"1"
T = input()+"1"
U = ""

k = 0
while k < N:
    if S[k] == S[k+1]:
        U = U + "Y"
        k += 2
    else:
        U = U + "T"
        k += 1

if U[0] == "Y":
    ans = 6
else:
    ans = 3

mod = 1000000007
U = "1" + U
for k in range(2,len(U)):
    if U[k] == U[k-1] == "T":
        ans *= 2
        ans %= mod
    elif U[k-1] == "Y" and U[k] == "T":
        ans *= 1
        ans %= mod
    elif U[k-1] == "T" and U[k] == "Y":
        ans *= 2
        ans %= mod
    elif U[k-1] == "Y" and U[k] == "Y":
        ans *= 3
        ans %= mod

print(ans)

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);

    ll n,m,s; cin>>n>>m>>s;
    vector<vector<tuple<ll,ll,ll>>> edges(n); // node, cost, time
    rep(i,m){
        ll u,v,a,b; cin>>u>>v>>a>>b;
        u--; v--;
        edges[u].emplace_back(v, a, b);
        edges[v].emplace_back(u, a, b);
    }
    vint c(n),d(n);
    rep(i,n) cin>>c[i]>>d[i];

    vvint dp(n, vint(5001, LLONG_MAX));

    // dp[0][min(5000ll, s)] = 0;


    priority_queue<tuple<ll,ll,ll>, vector<tuple<ll,ll,ll>>, greater<tuple<ll,ll,ll>>> q;  // time, node, money
    q.push(mt(0,0,min(5000ll, s)));

    while(!q.empty()){
        ll now, mon, ti;
        tie(ti,now,mon) = q.top(); q.pop();
        if(dp[now][mon] <= ti) continue;
        dp[now][mon] = ti;

        if(mon < 5000) q.push(mt(ti+d[now], now, min(5000ll, mon+c[now])));
        // 交換

        for(auto p:edges[now]){
            ll to, cost, delt;
            tie(to,cost,delt) = p;
            if(cost > mon) continue;
            if(dp[to][mon-cost] <= ti+delt) continue;
            q.push(mt(ti+delt, to, mon-cost)); // 移動
        }
    }

    repf(i,1,n){
        ll ans = LLONG_MAX;
        rep(j, 5001) chmin(ans, dp[i][j]);
        cout<<ans<<endl;
    }






    return 0;

}

Measured memory_bytes: 17496
X = int(input())
A = 0
B = 0

A = X - X % 500#A:500
A500 = A / 500 * 1000
#A5 = (X % 500) % 5 * 5
A5 = X % 500 - (X % 500) % 5#495
A5 = A5 / 5 * 5
A = int(A500) + int(A5)
B = (X - X % 5)
B = int(B / 5 * 5)

print(int(max(A, B)))

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

if x >= 1800:
  out = 1
elif x >= 1600:
  out = 2
elif x >= 1400:
  out = 3
elif x >= 1200:
  out = 4
elif x >= 1000:
  out = 5
elif x >= 800:
  out = 6
elif x >= 600:
  out = 7
else:
  out = 8

print(out)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, s,sum=0;
	cin >> n;
	vector<int>point(n),notTen;
	rep(i, n) {
		cin >> s;
		point[i] = s;
		if (s % 10 != 0)notTen.push_back(s);
	}
	sum = accumulate(all(point), 0);
	sort(all(notTen));
	if (sum % 10 != 0)cout << sum << endl;
	else {
		if (notTen.size())cout << sum - notTen[0] << endl;
		else cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 3576
import java.util.*;
class Main{
  public static void main(String[] args) {
    Scanner scan= new Scanner(System.in);
    boolean[][] trump = new boolean[4][13];
    char[] head = {'S' , 'H' , 'C' , 'D'};
    int n = scan.nextInt();
    for (int i = 0; i < n ; i++ ) {
      char head_in = scan.next().charAt(0);
      int num = Integer.parseInt(scan.next());

      switch(head_in){
        case 'S':trump[0][num-1] = true;break;
        case 'H':trump[1][num-1] = true;break;
        case 'C':trump[2][num-1] = true;break;
        case 'D':trump[3][num-1] = true;break;
      }
    }
    for (int i =0 ;i < 4 ;i++ ) {
      for (int j = 0;j < 13 ;j++ ) {
        if (trump[i][j] == false) {
          System.out.println(head[i]+" "+(j+1));

        }

      }

    }
  }
}

Measured memory_bytes: 26184
#include<stdio.h>
int main(){
  int a,b;

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

Measured memory_bytes: 580
//Harjot Singh Student NIT JALANDHAR	

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;

int main()
{
    

    ll n=0;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    	cin>>arr[i];
    ll dp[n];
    dp[1]=abs(arr[1]-arr[0]);
    dp[0]=0;
    for(int i=2;i<n;i++)
    {
    	dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);

    }
    cout<<dp[n-1]<<endl;
  
  	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <limits.h>
int main(void){
    int N, T, A, minPos;
    if (scanf("%d%*c%d %d%*c", &N, &T, &A) == -1) return -1;
    int H[N];
    double temp[N], min = INT_MAX;
    for (int i = 0; i < N; i++) {
        if (scanf("%d%*c", &H[i]) == -1) return -1;
        temp[i] = fabs(T - 0.006 * H[i] - A);
        if (temp[i] < min) {
            min = temp[i];
            minPos = i;
        }
    }
    printf("%d\n", minPos + 1);
    return 0;
}


Measured memory_bytes: 128
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

class unionfind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.size = [1 for i in range(n)]
    def find(self,a):
        if a == self.parent[a]: return a
        else: self.parent[a] = find(self,self.parent[a]); return self.parent[a]
    def unite(self,a,b):
        pa,pb = self.find(self,a), self.find(self,b)
        if pa == pb: return
        else: self.parent[pb] = pa; self.size[pa] += self.size[pb]
    def same(self,a,b): return find(self,a) == find(self,b)

n,k = imap()
for i in range(31):
    if k**i > n: ans = i; break
print(ans)


Measured memory_bytes: 37836
n = gets.chomp.to_i
f = []
n.times do
  f.push(gets.chomp.split.map(&:to_i))
end
p = []
n.times do
  p.push(gets.chomp.split.map(&:to_i))
end

ans = -1000000000000
[0, 1].repeated_permutation(10) do |arr|
  next if arr.all?{|e| e == 0}
  count = Array.new(n, 0)
  f.each.with_index do |ff, i|
    10.times do |t|
      count[i] += 1 if ff[t] == 1 && arr[t] == 1
    end
  end
  tmp = 0
  p.each_with_index do |pp, index|
    tmp += pp[count[index]]
  end
  ans = tmp if tmp > ans
end
p ans


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

int main() {
	long long n;cin>>n;
	vector<long long> a;
	long long sum=0;
	for(long long i=0;i<n;++i){
		long long tmp; cin >> tmp;
		sum +=tmp;
		a.push_back(sum);
	}
	long long diff = sum;
	for(long long j=0;j<n;++j) diff = min(diff, abs(sum - 2* a[j]));
	cout << diff << endl;
	return 0;
}

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

int x, y;

int main() {
    cin >> x >> y;

    int ans = 3.0e9;
    if (y >= x) ans = min(ans, y-x);
    if (-y >= x) ans = min(ans, -y-x+1);
    if (y >= -x) ans = min(ans, y+x+1);
    if (-y >= -x) ans = min(ans, -y+x+2);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define lihanyang ll
#define lhy int
#define huaji std
using namespace huaji;
lhy main()
{
	lhy a,b,c;
	cin>>a>>b>>c;
    for(lhy s=1;s<=1000;s++)
    {
        if((a*s)%b==c)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* 定数 {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

int c[26];

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

  string str;
  bool f = true;

  cin >> str;

  REP(i, str.size()) c[str[i] - 'a']++;

  REP(i, 26) if (c[i] % 2 == 1) f = false;
  
  (f)?cout << "Yes" << endl:cout << "No" << endl;

  return (0);
}



Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int n=sc.nextInt();
			if(n==0){
				break;
			}
			for(int i=0; i<n; i++){
				int pm=sc.nextInt();
				int pe=sc.nextInt();
				int pj=sc.nextInt();
				if((pm==100||pe==100||pj==100)||(pm+pe>=180)||(pm+pe+pj>=240)){
					println("A");
				}else if((pm+pe+pj>=210)||(pm+pe+pj>=150&&(pm>=80||pe>=80))){
					println("B");
				}else{
					println("C");
				}
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int a[4],b[4],v[4][4];
void go()
{
	for(int i=1;i<4;i++)
	for(int j=1;j<4;j++)
	if(a[i]+b[j]!=v[i][j])return;
	puts("Yes");exit(0);
}
int main()
{
	for(int i=1;i<4;i++)
	for(int j=1;j<4;j++)
	cin>>v[i][j];
    for(a[1]=0;a[1]<=v[1][1];a[1]++)
    for(a[2]=0;a[2]<=v[2][2];a[2]++)
    for(a[3]=0;a[3]<=v[3][3];a[3]++)
    {
    	b[1]=v[1][1]-a[1];
    	b[2]=v[2][2]-a[2];
    	b[3]=v[3][3]-a[3];
    	go();
	}
	puts("No");
	return 0;
}
/*	a1+b1=v11
	a1+b2=v12
	a1+b3=v13
	a2+b1=v21
	a2+b2=v22
	a2+b3=v23
	a3+b1=v31
	a3+b2=v32
	a3+b3=v33
	b3-b2=v13-v12;
//	3(a1...3+b1...3)/3
//	a1+...3+b1...3*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N;
vi a[400];
ll ans = 0;
unordered_map<ll,int> u;

ll hsh(vi v) {
    return v[0]+1000LL*v[1]+1000000LL*v[2]+1000000000LL*v[3];
}

vi rot(vi a, int b) {
    rotate(a.begin(),a.begin()+b,a.end());
    return a;
}

ll minRot(vi a) {
    ll z = 1e12;
    F0R(i,4) z = min(z,hsh(rot(a,i)));
    return z;
}

void ad(int x, int ind) {
    F0R(i,4) u[hsh(rot(a[x],i))] += ind;
}

void tri(int x, int y) {
    F0R(i,4) {
        vi t1 = a[x]; 
        vi t2 = rot(a[y],i); reverse(all(t2));
        
        ll num = 1;
        vl p;
        
        F0R(j,4) {
            vi z = {t2[j],t2[(j+1)%4],t1[(j+1)%4],t1[j]};
            ll Z = hsh(z);
            ll tnum = u[Z];
            for (auto a: p) if (a == Z) tnum --;
            num *= tnum;
            F0R(i,4) p.pb(hsh(rot(z,i)));
        }
        ans += num;
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    F0R(i,N) {
        a[i].resize(4);
        F0R(j,4) cin >> a[i][j];
        ad(i,1);
    }
    F0R(i,N) {
        ad(i,-1);
        FOR(j,i+1,N) {
            ad(j,-1);
            tri(i,j);
            ad(j,1);
        }
    }
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 61584
#include <stdio.h>
int main()
{
    int n, m, i, j;
    int a, b;
    int A[100][100] = {0};
    int B[100] = {0};
    int c[100] = {0};
    scanf("%d %d ", &n, &m);
    for (j = 0; j < n; j++)
    {
        for(i = 0; i < m; i++)
        {
            scanf("%d", &a);
            A[j][i] = a;
        }
    }
    for(j = 0; j < m; j++)
    {
        scanf("%d", &b);
        B[j] = b;
    }

    for(j = 0; j < n; j++)
    {
        for(i = 0; i < m; i++)
        {
            c[j] = c[j] + A[j][i] * B[i];
        }
    }

    for(i = 0; i < n; i++)
    {
        printf("%d\n", c[i]);
    }
    return 0;
}



Measured memory_bytes: 2044
from collections import Counter

N,A = map(int,input().split())
src = list(map(int,input().split()))

dp = [Counter({0:1})]

for i,a in enumerate(src):
    dp.append(Counter())
    for j in reversed(range(i+1)):
        for k,v in dp[j].items():
            dp[j+1][k+a] += v

ans = 0
for i,ctr in enumerate(dp):
    if i==0: continue
    ans += ctr[i*A]
print(ans)

Measured memory_bytes: 5484
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<LL,LL>
#define LL long long
using namespace std;

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    LL n,k;
    cin >> n >> k;
    LL a[n+5];
    for (LL i=1;i<=n;i++) cin >> a[i];
    LL l=1,r=1e9,ans=1e9;
    while (l <= r) {
        LL m = (l+r)/2;
        LL cnt = 0;
        for (LL i=1;i<=n;i++) {
            if (a[i] <= m) continue;
            cnt += (a[i])/m;
        }
        // cout << m << " " << cnt << endl;
        if (cnt <= k) {
            ans = m;
            r = m-1;
        } else if (cnt > k) {
            l = m+1;
        }
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 5152
import java.util.Scanner;

public class Main {

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

        int a = sn.nextInt();
        int b = sn.nextInt();

        
        int min = b -a +1;
        int max = b + a -1;

        
        for(int i = min; i <= max; i++){
         System.out.println(i);
        }
    }
}

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


Measured memory_bytes: 256
from fractions import gcd


MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

lcm = A[0]

for a in A:
    lcm = (lcm * a) // gcd(lcm, a)

ans = 0
lcm %= MOD
for a in A:
    ans += lcm * pow(a, MOD - 2, MOD)
    ans %= MOD

print(ans)


Measured memory_bytes: 67416
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int A,B,T;
    cin >> A >> B >> T;
    
    int biscuit = 0;
    
    for(int i=1;i<=T;i++){
        if(i%A==0){
            biscuit = biscuit+B;
        }
    }
    cout << biscuit << endl;
    
return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll Sn;
char S[202020], T[202020];
char mkt[256],mks[256];
ll i, j, k;
int main(){
    scanf("%s%s", S, T);
    Sn = strlen(S);
    fornum(i,0,Sn){
        if(mkt[S[i]]==0){
            mkt[S[i]] = T[i];
        }else if(mkt[S[i]]!=T[i]){
            break;
        }
        if(mks[T[i]]==0){
            mks[T[i]] = S[i];
        }else if(mks[T[i]]!=S[i]){
            break;
        }
    }
    if(Sn==i){
        printf("Yes");
    }else{
        printf("No");
    }


    return 0;
}

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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define ALL(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& a, const T& b, const T& p, const T& q)
{ return p <=b && a <= q; }

#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl


template<class T> void sort3a(T& a,T& b,T& c) {if (a>b) swap(a,b); if (b>c) swap(b,c); if (a>b) swap(a,b);}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int A,B,C; cin >>A>>B>>C;
    sort3a(A,B,C);

    int ans;
    
    ans = C-B;
    if ((B-A) % 2 == 0)
        ans += (B - A) / 2;
    else
        ans += (B-A + 1) / 2 + 1;

    cout << ans << endl;
}


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

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    for (int j = 1; j < 3; j++) {
        int diff = c[0][j] - c[0][0];
        for (int i = 1; i < 3; i++) {
            if (diff != c[i][j] - c[i][0]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 1; i < 3; i++) {
        int diff = c[i][0] - c[0][0];
        for (int j = 1; j < 3; j++) {
            if (diff != c[i][j] - c[0][j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
//#define _GLIBCXX_DEBUG

signed main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> p(N+1, vector<int>(0));
  rep(i, M) {
    int a, b; cin >> a >> b;
    p[a].push_back(b);
    p[b].push_back(a);
  }
  
  vector<int> ans(N+1, 0);
  ans[0] = 1;
  ans[1] = 1;
  
  queue<int> q;
  q.push(1);
  
  int k=0;
  while(!q.empty()) {
    int n = q.front();
    q.pop();
    rep(i, p[n].size()) {
      int a = p[n][i];
      if(ans[a] == 0) {
        ans[a] = n;
        k++;
        q.push(a);
      } else {
        p[n].erase(p[n].begin()+i);
        i--;
      }
    }
    if(k == N-1) {
      cout << "Yes" << endl;
      rep(i, N+1) if(i >= 2) cout << ans[i] << endl;
      break;
    }
  }
}

Measured memory_bytes: 12952
h, w = map(int, input().split())
a = [input() for i in range(h)]
c = '#'
out = '' 
for i in range(2+w):
    out += c
print(out)
out = c
for i in range(h):
    out += str(a[i])+c
    print(out)
    out = c 

for i in range(1+w):
    out += c
print(out)


Measured memory_bytes: 38512
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

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

    for(int i=0;i<n;++i){
        string m;
        string pat;

        cin >> m >> pat;
        reverse(m.begin(), m.end());
        int sz = pat.size();
        for(int j=0;j<m.size();j++){
            if(m[j] == 'A'){
                reverse(pat.begin(), pat.end());
            }else if(m[j] == 'M'){
                for(int k=0;k<pat.size();++k){
                    if(pat[k] == '9'){
                        pat[k] = '0';
                    }else if('0' <= pat[k] && pat[k] <= '8'){
                        pat[k]++;
                    }
                }
            }else if(m[j] == 'P'){
                for(int k=0;k<pat.size();++k){
                    if(pat[k] == '0'){
                        pat[k] = '9';
                    }else if('1' <= pat[k] && pat[k] <= '9'){
                        pat[k]--;
                    }
                }
            }else if(m[j] == 'C'){
                pat += pat[0];
                pat = pat.substr(1,sz);
            }else if(m[j] == 'J'){
                string tmp = "";
                tmp += pat[sz-1];
                tmp += pat.substr(0,sz-1);
                pat = tmp;
            }else if(m[j] == 'E'){
                string pre="",suf="", mid="";
                for(int k=0;k<sz/2;++k){
                    pre += pat[k];
                }
                if(sz % 2 == 1){
                    mid += pat[sz/2];
                }
                for(int k=(sz+1)/2;k<sz;++k){
                    suf += pat[k];
                }
                pat = suf + mid + pre;
            }
        }
        cout << pat << endl;
    }
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;


int main()
{
	cin >> s; bool x = true;
	if (s.size() % 2 == 1)
      {cout << "No" << endl;return 0;}
	rep(i, s.size())
	{
		if (i % 2 == 0)
		{
			if (s[i] != 'h')
				x = false;
		}
		else
		{
			if (s[i] != 'i')
				x = false;
		}
	}

	if (x)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,i,s,M[]={2,3,1,3,2,3,2,3,3,2,3,2,3};
  char d[][10]={"Monday","Tuesday","Wednesday","Thursday",
		"Friday","Saturday","Sunday"};
  while(scanf("%d %d",&a,&b),a||b){
    for(i=s=0;i<a;i++)s+=M[i];
    s+=b;
    printf("%s\n",d[s%7]);
  }
  return 0;
}
	

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */



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

	LL N; cin >> N;
	VL L(N), R(N);
	LL ans = 0;
	FOR(i, 0, N) {
		cin >> L[i] >> R[i];
		ans += R[i] - L[i] + 1;
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std; 

int main() {
   int N, R;
   cin >> N >> R;
   if(N >= 10) {
       cout << R << endl;
   } else {
       cout << R + 100 * (10 - N) << endl;
   }
}

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

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

#define pb push_back
#define mp make_pair
#define fora(i, a, n) for(int i = a; i < n; i++)
#define forb(i, a, n) for (int i = a; i >= (n); --i)
#define PI 3.1415926535897932384626433832795
#define INF 1e9

int main(){ 
ios::sync_with_stdio(false);
cin.tie(NULL);
//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
/////////////////////////////////
ll x;
cin >> x;
int ans = 0;
ans += 1000*(x/500); x %= 500;
ans += 5*(x/5);
cout << ans;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

int main()
{
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;

  string S;
  cin >> S;
  S = "#" + S + "#";

  bool isOverSunuke = true;
  if (C > D) {
    isOverSunuke = false;
    /// A　が Bを飛び越えてCに到達
    for (int i=B; i <= D; i++) {
      if (S.at(i - 1) == '.' && S.at(i) == '.' && S.at(i + 1) == '.') {
        isOverSunuke = true;
        break;
      }
    }
  }

  bool isPassable = true;
  for (int i=A; i < C; i++) {
    if (S.at(i) == '#' && S.at(i + 1) == '#') {
      isPassable = false;
    }
    
  }
  for (int i=B; i < D; i++) {
    if (S.at(i) == '#' && S.at(i + 1) == '#') {
      isPassable = false;
    }
  }

  if (isOverSunuke && isPassable) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 772