akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s;
    cin >> s;
    int a = 0;
    int b = 0;
    int c = 0;
    REPS(ch, s) {
        if (ch == 'a') a++;
        else if (ch == 'b') b++;
        else if (ch == 'c') c++;
    }
    if (max({a, b, c}) - min({a, b, c}) <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3736
#include<stdio.h>

int main(){
    int x, y, temp;
    
    scanf("%d %d", &x, &y);
    if(y > x){
    	temp = x;
    	x = y;
    	y = temp;
    }
    
    while(1){
    	temp = y;
    	y = x % y;
    	x = temp;
    	if(y == 0){
    		break;
    	}
    }
    
    printf("%d\n", x);
    
    return 0;
}



Measured memory_bytes: 2052
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a*b/gcd(a,b);
}

int main(void){
    vector<int>c;
    string s;
    cin>>s;
    rep(i,s.length()){
        switch(s[i]){
        case '1':
            c.push_back(1);
            break;
        case '0':
            c.push_back(0);
            break;
        case 'B':
            if(c.size()){
                c.erase(c.end()-1);
            }
        }
    }
    rep(i,c.size()){
        cout<<c[i];
    }
}
/*
*/


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef pair<int, int> pa;
typedef vector<pair<int,int> > vepa;
typedef map<int, int> mp;
const ll N=1e5+5;
ll arr[N],A[N],ARR[N]  ;
bool visited[N]={};
ll cnt[N]={};
bool f;
 int main()
{
   int n,m,count(0);
   string s;
   ve v;
   cin>>n>>m>>s;
   v.p_b(0);
   rep(i,n)
   {
       if(s[i]=='A'&&s[i+1]=='C'){
       count++;
        }
        v.p_b(count);
   }
      while(m--)
      {
          int a,b;
          cin>>a>>b;
          a-- ,b--;
          cout<<v[b]-v[a]<<endl;
      }

go;
}


Measured memory_bytes: 1528
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define mod 998244353
#define MAX 8005
using namespace std;
//char nc()
//{
//	static char buf[100000],*p1=buf,*p2=buf;
//	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
char nc(){return getchar();}
int read()
{
	int x=0,y=1;
	char c=nc();
	while(!isdigit(c))
	{
		if(c=='-')y=-1;
		c=nc();
	}
	while(isdigit(c))
	{
		x=(x<<1)+(x<<3)+(c^48);
		c=nc();
	}
	return x*y;
}
namespace ntt
{
	long long mo(long long x)
	{
		return x<mod?x:x-mod;
	}
	long long quick_pow(long long x,long long y)
	{
		long long re=1;
		while(y)
		{
			if(y&1) re=re*x%mod;
			x=x*x%mod;
			y>>=1;
		}
		return re;
	}
	int rev[MAX<<3];
	long long wi[MAX<<3];
	int make(int n)
	{
		int l=log2(n)+1;n=1<<l;
		for(int i=0;i<n;i++)
			rev[i]=((rev[i>>1]>>1)|((i&1)<<(l-1)));
		return n;
	}
	void dft(long long a[],int n,long long flag)
	{
		for(int i=0;i<n;i++)
			if(rev[i]<i) swap(a[i],a[rev[i]]);
		for(int i=1;i<n;i<<=1)
		{
			long long wn=quick_pow(3,mod-1+flag*(mod-1)/(i<<1));
			wi[0]=1;
			for(int j=1;j<i;j++)
				wi[j]=wi[j-1]*wn%mod;
			for(int j=0;j<n;j+=i<<1)
				for(int k=0;k<i;k++)
				{
					long long x=a[j+k],y=a[j+k+i]*wi[k]%mod;
					a[j+k]=mo(x+y);a[j+k+i]=mo(x-y+mod);
				}
		}
		if(flag==-1)
		{
			long long inv=quick_pow(n,mod-2);
			for(int i=0;i<n;i++)
				a[i]=a[i]*inv%mod;
		}
	}
	long long ta[MAX<<3],tb[MAX<<3];
	void mul(long long a[],long long b[],int n,int ln)
	{
		for(int i=0;i<=n;i++)
			ta[i]=a[i],tb[i]=b[i];
		for(int i=n+1;i<ln;i++)
			ta[i]=0,tb[i]=0;
		dft(ta,ln,1);dft(tb,ln,1);
		for(int i=0;i<ln;i++)
			ta[i]=ta[i]*tb[i]%mod;
		dft(ta,ln,-1);
		for(int i=0;i<ln;i++)
			a[i]=ta[i];
	}
}
using namespace ntt;
int n,m;
long long fac[MAX],inv[MAX],facinv[MAX],f[205][MAX],g[MAX<<3],h[MAX<<3];
long long C(int down,int up)
{
	if(down<up) return 0;
	return fac[down]*facinv[down-up]%mod*facinv[up]%mod; 
}
int main()
{
	n=read();m=read();
	fac[0]=fac[1]=1;inv[1]=1;facinv[0]=facinv[1]=1;
	for(int i=2;i<=n+2;i++)
		fac[i]=fac[i-1]*i%mod,
		inv[i]=inv[mod%i]*(mod-mod/i)%mod,
		facinv[i]=facinv[i-1]*inv[i]%mod;
	for(int i=0;i<=n;i++)
		f[m][i]=C(n,i);
	int ln=make(n*2+2);
	for(int i=m-1;i>=0;i--)
	{
		for(int j=0;j<=n;j++)
			g[j]=f[i+1][j]*fac[j+2]%mod,h[j]=facinv[n-j+2];
		h[n]=0;
		mul(g,h,n,ln);
		for(int j=0;j<=n;j++)
			f[i][j]=(g[n+j]*facinv[j]+f[i+1][j]*((C(j+1,2)+1)))%mod;
	}
	printf("%lld",f[0][0]);
	return 0;
}

Measured memory_bytes: 17116
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;
//typedef __int64 LL;
typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;
LL s[200020];
vector<int> v[200020];
int main(){
	LL n,k;cin>>n>>k;
	map<LL,LL> po;
	s[0]=0;
	po[0]++;
	for(LL i=1;i<=n;i++)
	{
		LL x;cin>>x;
		x--;
		if(i==1)s[1]=x;
		else s[i]=s[i-1]+x;
		s[i]=s[i]%k;
		po[s[i]]++;
		//cout<<s[i]<<"\n";
	} 
	LL ans=0;
	if(k>=n+10)
	{
		map<LL,LL>::iterator p; 
		for(p=po.begin();p!=po.end();p++)
		{
			LL y=(p->second);
			ans+=y*(y-1)/2;
		}
		cout<<ans<<"\n";
		return 0;
	}
	
	for(int i=0;i<=n;i++)
	{
		v[s[i]].push_back(i);	
	}
	for(int i=0;i<=n;i++)
	{
		int len=v[i].size();
		sort(v[i].begin(),v[i].end());
		for(int j=0;j<v[i].size();j++)
		{
			ans+=(LL)(lower_bound(v[i].begin(),v[i].end(),v[i][j]+k)-v[i].begin())-1-j;	
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 18944
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define rrep(i, a, b) for(int i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;

const int MOD = 1e9+7;

void addSelf(int &a, int b){
  a += b;
  if(a >= MOD) a -= MOD;
  if(a < 0) a += MOD;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  int n,k; cin >> n >> k;
  vi dp(k+1); dp[0] = 1;
  rep(i,0,n){
    int up; cin >> up;
    vi delta(k+1);
    rrep(j,k,0){
      int a = j + 1;
      int b = j + min(up, k-j);
      int tmp = dp[j];
      if(a <= b){
        addSelf(delta[a], tmp);
        if(b+1 <= k)
          addSelf(delta[b+1], -tmp);
      }
    }
    int inc = 0;
    rep(j,1,k+1){
      addSelf(inc, delta[j]);
      addSelf(dp[j],inc);
    }
  }
  cout << dp[k];
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i <= n; i++)
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

int n;

void dfs(string s, char mx){
    if(s.size() == n) {
        cout << s << endl;
        return;
    }

    for (char c = 'a'; c <= mx; c++) {
        dfs(s + c, (mx == c ? (char)(c + 1) : mx));
    }
}

int main() {
   cin >> n;
   dfs("a", 'b');
   return 0;
}


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

using namespace std;

int main()
{
  int n, money = 100000;
  while (scanf(" %d ", &n) == 1) {
    for (int i = 0; i < n; i++) {
      money += (double)money * 0.05;
      if (money % 1000 != 0) {
	money += 1000 - money % 1000;
      }
    }
    printf("%d\n", money);
  }
  return 0;
}

Measured memory_bytes: 0
S = input()

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)


Measured memory_bytes: 9024
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int N, L;
    cin >> N >> L;
    string S[N];
    for(int i = 0; i < N; i++)
        cin >> S[i];
    sort(S, S + N);
    for(int i = 0; i < N; i++)
        cout << S[i];
    cout << endl;
    return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int[] A = ria();
		Array.Sort(A);
		Console.WriteLine(A[0] == 1 && A[1] == 4 && A[2] == 7 && A[3] == 9 ? "YES" : "NO");
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
  int N;
  cin>>N;
  vector<int>A(N);
  vector<int>B(N);
  vector<int>C(N-1);
  int ans=0;
  rep(i,N){
      cin>>A[i];
  }
  rep(i,N){
    cin>>B[i];
    ans+=B[i];
  }
  rep(i,N-1){
      cin>>C[i];
  }
  rep(i,N){
    if(i!=0){
        if(A[i]-A[i-1]==1){
            ans+=C[A[i]-2];
        }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3604
# include <iostream>
# include <cstdio>
# define Maxn 100010
# define ll long long
using namespace std;
ll n,m,cnt;
ll h[5*Maxn],to[5*Maxn],nxt[5*Maxn];
ll colour[5*Maxn],num[5*Maxn];
ll ans;
void add(ll x,ll y){
	to[++cnt]=y;
	nxt[cnt]=h[x];
	h[x]=cnt;
}
void dfs(ll x,ll col,ll fa){
	colour[x]=col;num[col]++;
	for(ll i=h[x];i;i=nxt[i]){
		ll y=to[i];
		if(y==fa) continue;		
		if(colour[y]==colour[x]){
			printf("%lld",n*(n-1)/2-m);
			exit(0);
		}
		if(!colour[y])
		dfs(y,3-col,x);
	}
}
int main(){
	scanf("%lld%lld",&n,&m);
	for(ll i=1;i<=m;i++){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		add(a,b),add(b,a);
	}
	dfs(1,1,0);
	ans=num[1]*num[2];
	printf("%lld",ans-m);		
	return 0;
}

Measured memory_bytes: 17024
import java.util.Scanner;
public class Main {

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

		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = c-a-b;
		
		if(d>0 && 4*a*b < d*d) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		
	}

}

Measured memory_bytes: 22996
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

bool isPalindrome(int a)
{
    ostringstream oss;
    oss << a;

    string s = oss.str();
    reverse(s.begin(), s.end());
    return s == oss.str();
}

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

    for(int i=0; ; ++i){
        int a = n;
        if(i % 2 == 1)
            a -= (i + 1) / 2;
        else
            a += (i + 1) / 2;

        if(isPalindrome(a)){
            cout << a << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1220
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ab = []
for i in A:
  for j in B:
    ab.append(i + j)

ab.sort(reverse = True)

abc = []
for i in ab[:3000]:
  for j in C:
    abc.append(i + j)

abc.sort(reverse = True)

for i in range(K):
  print(abc[i])


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

int main(){
    int city,street;
  cin >> city>>street;
  
  vector<int> num(2*street);
  for(int i=0;i<2*street;i++){
    cin >> num[i];
     }
  
  for(int i=0;i<city;i++){
    int ans=0;
    for(int j=0;j<2*street;j++){
      if(num[j]==i+1){ans++;}
     }
   cout << ans <<endl; 
    
  }
}


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

int main(void){
    string aa;
    int a[4],sum = 0;
    char b[3];
    cin >> aa;
    for(int i = 0;i < 4;i++)a[i] = aa[i]-'0';
    
    for(int i = 0;i < (1 << (aa.size() - 1));i++){
        sum = a[0];
        for(int j = 0;j < 3;j++){
            if(i & (1 << j)){
                sum += a[j+1];
                b[j] = '+';
            } else {
                sum -= a[j+1];
                b[j] = '-';
            }
        }
        if(sum == 7){
            break;
        }
    }
    for(int k = 0;k < 3;k++)cout << a[k] << b[k];
    cout << a[(aa.size()-1)] << "=7" << endl;
}

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

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

	int a[30];
	int tmp = 1;
	rep (i, 30) {
		a[i] = tmp;
		tmp *= 2;
	}

	int N;
	cin >> N;
	vector<int> vi;
	int keta[30] = {0, };
	rep (i, N) {
		cin >> tmp;
		vi.push_back(tmp);
		rep (j, 30) {
			if (tmp & a[j]) keta[j]++;
		}
	}

	rep (i, 30) {
		keta[i] %= 2;
	}

	int XOR = 0;
	rep (i, 30) {
		if (keta[i]) XOR += a[i];
	}

	rep (i, N) {
		cout << (vi[i] ^ XOR) << " ";
	}

	return 0;
}


Measured memory_bytes: 4220
n,s=map(int,input().split())
listc=[]
listt=[]
for i in range(n):
    c,t=map(int,input().split())
    listc.append(c)
    listt.append(t)
import copy
listct=copy.copy(listt)
for t in listct:
    if t>s:
        listc.pop(listt.index(t))
        listt.pop(listt.index(t))
if len(listt)==0:
    print('TLE')
else:
    print(min(listc))


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n,k;
    cin >> n >> k;
    vector<int>cnt(n);
    rep(i,k) {
        int d;
        cin >> d;
        vector<int>a(n);
        rep(i,d) {
            cin >> a[i];
            cnt[a[i]-1]++;
        }
    }
    int ans = 0;
    rep(i,n) {
        if(!cnt[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#include <tuple>
#include <algorithm>
using namespace std;
using lint = long long;
int N, K, Q, arr[2000], sorted[2000];
vector<tuple<int, int>> subseq;
lint calc(int lb) {
    subseq.clear();
    int last = 0;
    for(int n = 0; n < N; n++) {
        if(arr[n] < lb) {
            if(last == n) {
                last = n+1;
            }
            else {
                subseq.emplace_back(last, n);
                last = n + 1;
            }
        }
    }
    priority_queue<int> pq;
    vector<int> lst;
    if(last < N) subseq.emplace_back(last, N);
    for(auto &seq: subseq) {
        int b, e;tie(b, e) = seq;
        if(e - b >= K) {
            for(int i = b, sz = e-b-K+1; i < e; i++) {
                pq.push(arr[i]);
                if(pq.size() > sz) pq.pop();
            }
            while(!pq.empty()){
                lst.push_back(pq.top());
                pq.pop();
            }
        }
    }
    if(lst.size() < Q) return 0x3f3f3f3f3f3f3f3f;
    else {
        sort(lst.begin(), lst.end());
        return lst[Q-1];
    }
}
lint ans = 0x3f3f3f3f3f3f3f3f;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);

    cin>>N>>K>>Q;
    for(int n = 0; n < N; n++) cin>>arr[n];
    for(int n = 0; n < N; n++) sorted[n] = arr[n];
    sort(sorted, sorted + N);
    for(int lbi = 0, lb = sorted[0]; lbi < N; lb = sorted[++lbi]){
        lint ub; ans = min(ans, (ub = calc(lb)) - lb);
//        cout<<"|"<<lb<<" - "<<ub<<"| => "<<(ub-lb)<<'\n';
        if(ub == 0x3f3f3f3f3f3f3f3f) break;
    }
    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A,B,C,tot,a,b,c;
int main(){
    scanf("%d%d%d",&A,&B,&C);
    while(!((A&1)||(B&1)||(C&1)))
	{
        if(A==B&&B==C)
		{
            puts("-1");
            return 0;
        }
        tot++,a=(B+C)>>1,b=(A+C)>>1,c=(B+A)>>1;
        A=a,B=b,C=c;
    }
     
    printf("%d\n",tot);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};
 int main(){
   ll n,m,k; cin>>n>>m>>k;
   UnionFind uf(n) ;
   vector<ll> fr(n) ;
   rep(i,m){
     ll a,b ; cin>>a>>b ;
     a-- ;b-- ;
     uf.unite(a,b) ;
     fr[a]++ ; fr[b]++ ;
   }
   // 友達とブロックを引く
   vector<ll> bl(n) ;
   rep(i,k){
    ll a,b ; cin>>a>>b ;
    a-- ;b-- ;
    if(uf.same(a,b)){
      bl[a]++ ;
      bl[b]++ ;
    }
   }
   rep(i,n){
    cout<<uf.size(i)-fr[i]-bl[i]-1<<endl ;
   }
   return 0;
  }

Measured memory_bytes: 5116
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string N;
	cin >> N;
	REP(i, SZ(N)) {
		if (N[i] == '1')cout << "9";
		else cout << "1";
	}
	cout << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(H)]
res = 0
for k in range(10):
  for i in range(10):
    for j in range(10):
      c[i][j] = min(c[i][k] + c[k][j], c[i][j])
for y in range(H):
  for x in range(W):
    if (a[y][x] != -1) or (a[y][x] == 1):
      res += c[a[y][x]][1]
print(res)

Measured memory_bytes: 40412
s=gets.chomp
r=s.clone.reverse
cnt=0

if s.size%2==0
    s=s[0..(s.size/2)-1]
    r=r[0..(r.size/2)-1]
else
    s=s[0..((s.size-1)/2)-1]
    r=r[0..((r.size-1)/2)-1]
end

(0..s.size-1).each do |x|
    if s[x] != r[x]
        cnt +=1
    end
end
p cnt

Measured memory_bytes: 1788
process.stdin.resume();
process.stdin.setEncoding('utf8');

var chunks = [];
process.stdin.on('data', function(chunk) {
    chunks.push(chunk.toString());
});
process.stdin.on('end', function() {
    main(chunks.join(""));
});

function main(input) {
 var lines = input.split("\n");
 var no = Number(lines[0]);
 var hoge = lines[1].split(" ").map(Number);
  
 var sum = 0;
 var max = hoge[0];
 var min = hoge[0];
  
 for(var i = 0; i < no; i++){
    var a = hoge[i];
    if (a > max){
        max = a;
    }
    if (a < min){
        min = a;
    }
    sum += a;
 }
  
 console.log(min, max, sum);
}

Measured memory_bytes: 17188
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD (int)(1e9+7)
#define INF (int)(1e9)
#define LLINF (int)(4e18)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int N; input(N);
    vector<int> p(N); input(p);
    int cnt = 0;
    REP(i, N-2) {
        if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) cnt++;
        else if (p[i] > p[i + 1] && p[i + 1] > p[i + 2]) cnt++;
    }
    cout << cnt << endl;
    getchar(); getchar();
}

Measured memory_bytes: 256
n = int(input())
s = input()
j = 1
result = [0]
end = n//2 + 1
for i in range(n):
    while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
    result.append(j-i-1)
print(max(result))

Measured memory_bytes: 3188
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  vector<int> A(3);
  rep(i,3) cin>>A[i];
  
  sort(ALL(A));
  
  rep(i,3){
    if(i) cout<<" ";
    cout<<A[i];
  }
  cout<<endl;
  
  return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = INF;

int main(void){
  
  I(N);
  vl W(N);
  ll sum = 0;
  REP(i, N) {
    I(W[i]);
    sum += W[i];
  }
  ll left = 0;
  REP(i, N-1) {
    left += W[i];
    sum -= W[i];
    chmin(ret, abs(left - sum));
  }

  P(ret);

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int h, w;
	int i, j, k, l;

	while (1){
		scanf("%d %d", &h, &w);
		if (h == 0 && w == 0){
			return 0;
		}
		for (i = 0; i < h; i++){
			if (i % 2 == 0){
				for (j = 0; j < w; j++){
					if (j % 2 == 0){
						printf("#");
					}
					else {
						printf(".");
					}
				}
			}
			else {
				for (j = 0; j < w; j++){
					if (j % 2 == 0){
						printf(".");
					}
					else {
						printf("#");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}
}

Measured memory_bytes: 572
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
    A,B = parseMap(split(readline())) 
    c = -1
    for i = 10000:-1:1
        if floor(i*0.08) == A && floor(i*0.1) == B 
            c = i
        end
    end 
    println(c)
end

main()

Measured memory_bytes: 166268
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int dp1[2][190][190][190], dp2[2][190][190][190];
char m[190][190];
int rui[190][190];
bool isok(int lx, int ly, int ux, int uy)
{
	int t = rui[ux + 1][uy + 1] - rui[ux + 1][ly] - rui[lx][uy + 1] + rui[lx][ly];
	return (t == 0 || t == (ux - lx + 1)*(uy - ly + 1));
}
void dcopy(int k, int x, int y, int mx, int my)
{
	int pt = mx - 1;
	for (int i = y; i < my; i++)
	{
		for (;;)
		{
			if (dp1[k][x][y][pt] < i)pt--;
			else break;
		}
		dp2[k][x][y][i] = max(dp2[k][x][y][i], pt);
	}
	pt = my - 1;
	for (int i = x; i < mx; i++)
	{
		for (;;)
		{
			if (dp2[k][x][y][pt] < i)pt--;
			else break;
		}
		dp1[k][x][y][i] = max(dp1[k][x][y][i], pt);
	}
}
void reset(int cur, int mx, int my)
{
	for (int i = 0; i <= mx; i++)
	{
		for (int j = 0; j <= my; j++)
		{
			dp1[cur][i][j][i - 1] = my - 1;
			for (int k = i; k <= my; k++)dp1[cur][i][j][k] = j - 1;
			dp2[cur][i][j][j - 1] = mx - 1;
			for (int k = j; k <= mx; k++)dp2[cur][i][j][k] = i - 1;
		}
	}
}
int main()
{
	int mx, my;
	scanf("%d%d", &mx, &my);
	for (int i = 0; i < mx; i++)scanf("%s", m[i]);
	for (int i = 0; i < mx; i++)for (int j = 0; j < my; j++)rui[i + 1][j + 1] = rui[i + 1][j] + rui[i][j + 1] - rui[i][j] + (m[i][j] == '#');
	reset(0, mx, my);
	for (int i = mx - 1; i >= 0; i--)
	{
		for (int j = my - 1; j >= 0; j--)
		{
			int pt = my - 1;
			for (int k = i; k < mx; k++)
			{
				for (;;)
				{
					if (isok(i, j, k, pt))break;
					pt--;
				}
				dp1[0][i][j][k] = max(dp1[0][i][j][k], pt);
				//printf("%d %d %d %d\n", i, j, k, pt);
			}
			dcopy(0, i, j, mx, my);
		}
	}
	//printf("aa\n");
	int cur = 0;
	reset(1, mx, my);
	for (int k = 0; k <= 16; k++)
	{
		if (dp1[cur][0][0][mx - 1] >= my - 1)
		{
			printf("%d\n", k);
			return 0;
		}
		for (int i = mx - 1; i >= 0; i--)
		{
			for (int j = my - 1; j >= 0; j--)
			{
				//for (int l = j; l < my; l++)printf("%d  %d %d %d %d\n", k, i, j, l, dp2[cur][i][j][l]);
				for (int l = i; l < mx; l++)
				{
					dp1[1 - cur][i][j][l] = max(dp1[1 - cur][i][j][l], dp1[cur][i][dp1[cur][i][j][l] + 1][l]);
				}
				for (int l = j; l < my; l++)
				{
					dp2[1 - cur][i][j][l] = max(dp2[1 - cur][i][j][l], dp2[cur][dp2[cur][i][j][l] + 1][j][l]);
				}
				dcopy(1 - cur, i, j, mx, my);
			}
		}
		reset(cur, mx, my);
		cur = 1 - cur;
	}
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,k,now=0;
    cin>>n>>k;
    vector<ll> a(n),dist(n);
    for (ll i = 0; i < n; i++)
    {
        cin>>a[i];
        a[i]--;
        dist[i]=-1;
    }
    dist[0]=k;
    
    for (ll i = k-1; i >= 0; i--)
    {
        ll next=a[now];
        if(dist[next]==-1)
        {
            dist[next]=i;
        }
        else
        {
            ll loop=dist[next]-i;
            i%=loop;
            //cout<<"loop "<<loop<<endl;
        }

        /*
        cout<<i<<" "<<now<<" "<<next<<"  ";
        for (int i = 0; i < n; i++)
        {
            cout<<dist[i]<<" ";
        }
        cout<<endl;
        */
        now=next;
    }
    
    cout<<now+1<<endl;
    
    return 0;
}

Measured memory_bytes: 6432
n = gets.to_s.to_i
s = gets.to_s.chomp

h = Hash.new(0)
s.each_char do |c|
  h[c] += 1
end

ans = h['R']* h['G'] * h['B']
n.times do |j|
  
  (1...n).each do |t|
    i = j - t
    k = j + t
    break if i < 0 || n - 1 < k
    ans -= 1 if s[i] != s[j] && s[j] != s[k] && s[k] != s[i]
  end
end

puts ans

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

int main() {
  lint L, R, d;
  cin >> L >> R >> d;

  lint ans = 0;
  for(lint i=L; i<=R; i++) {
    ans += (i%d == 0);
  }

  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long  X;
  cin >> X;
  //vector<int> A(M,0);
  long long  yokin = 100;

  long long year = 1;
  while(1){
    yokin = yokin * 1.01;
    if(yokin >= X){
      cout << year << endl;
      return 0;
    }
    year++;
  }

  return 0;
}

Measured memory_bytes: 3676
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;



int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int ans = 0;
    REP(i, n){
        cin >> p[i];
    }
    for (int i = 1; i < n-1; i++){
        vector<int> a(3);
        REP(j, 3) a[j] = p[i + j - 1];
        sort(ALL(a));
        if (a[1] == p[i]) ans++;
    }
    cout << ans << "\n";
}


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //good luck kittu!
    int k; string s;
    cin>>k>>s;
    if(s.size()<=k) return cout<<s<<"\n", 0;

    for(int i = 0; i<k; i++) cout<<s[i];
    cout<<"...\n";   
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    vector<vector<ll>> G(n+1,vector<ll> (n+1,INF));
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            char x;
            cin >> x;
            G[i][j]=x-'0';
        }
    }

    vector<ll> color(n+1,-1);
    queue<ll> que;
    bool flag = false;
    que.push(0);
    color[0]=0;
    while(!que.empty()){
        ll x= que.front();
        que.pop();
        for(j=0;j<n;j++){
            if(G[x][j]==1){
                if(color[j]==-1){
                    que.push(j);
                    color[j]=color[x]^1;
                }else{
                    if(color[j]==color[x]){
                        flag = true;
                        break;
                    }
                }
            }
        }
    }
    if(flag){
        cout << -1 << endl;
        return 0;
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(G[i][j]==0){
                G[i][j]=INF;
            }
        }
        G[i][i] = 0;
    }
    for(k=0;k<n;k++){
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }
    ll ret = 0;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            ret = max(ret,G[i][j]);
        }
    }
    cout << ret +1 << endl;
    return 0;
}

Measured memory_bytes: 1148
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }
    int n;
    cin >> n;
    cout << n * 2 * M_PI << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3832
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;

#define INF 1e18
#define int long long

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

    for(int i = 0; i < k; i++) {
        if(i % 2 == 0) {
            if(a % 2 != 0) {
                a--;
            }
            b += a / 2;
            a /= 2;
        } else {
            if(b % 2 != 0) {
                b--;
            }
            a += b / 2;
            b /= 2;
        }
    }

    cout << a << " " << b << endl;
    return 0; 
}


Measured memory_bytes: 256
// atcoder/abc161/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int n, m;
  while (cin >> n >> m) {
    vec<int> a(n);
    cin >> a;
    const int sum = accumulate(a.begin(), a.end(), 0);

    int cnt = 0;
    each (i, a) {
      cnt += (sum <= 4 * m * i);
    }

    if (m <= cnt) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,w;
	cin>>n>>w;
	ll weight[n],cost[n];
	for(ll i=0;i<n;i++)
	cin>>weight[i]>>cost[i];
	ll dp[n+1][w+1];
	for(ll i=0;i<=w;i++)
	dp[0][i]=0;
	for(ll i=0;i<=n;i++)
	dp[i][0]=0;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=w;j++)
		{
			if(j>=weight[i-1])
			dp[i][j] = max(dp[i-1][j],dp[i-1][j-weight[i-1]]+cost[i-1]);
			else 
			dp[i][j] = dp[i-1][j];
		}
	}
	cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 79104
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

from collections import Counter

u = Counter(s)
v = Counter(t)

ans = 0

for key, value in u.items():
    ans = max(ans, value - v[key])
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	int a, b, size;

	string s;

	cin>>a>>b>>s;

	size=s.size();

	bool flag=true;

	rep(i, size){
		if((s[i]=='-'&&i!=a)||(s[i]!='-'&&i==a)){
			flag=false;
		}
	}
	if(flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}



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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int32 n,m,s;

struct edge{
  int32 to,a;
  int64 b;
  edge(int32 to, int32 a, int64 b):to(to),a(a),b(b){}
};

vector<vector<edge>> adj;
vector<int64> c,d;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> s;
  adj.resize(n);
  REP(i,m){
    int32 u,v,a,b;
    cin >> u >> v >> a >> b;
    --u;--v;
    adj[u].emplace_back(v,a,b);
    adj[v].emplace_back(u,a,b);
  }
  c.resize(n);
  d.resize(n);
  REP(i,n)cin >> c[i] >> d[i];

  vector<vector<int64>> dp(n,vector<int64>(2505,LLINF));
  //pq : time, vertex, money 
  priority_queue<tuple<int64,int32,int32>,vector<tuple<int64,int32,int32>>,greater<tuple<int64,int32,int32>>> pq;
  auto push = [&](int64 t,int64 v,int64 g){
    if(dp[v][g] <= t)return;
    dp[v][g] = t;
    pq.emplace(t,v,g);
  };
  s = min<int32>(s,2500);
  push(0,0,s);
  while(!pq.empty()){
    auto [t,v,g] = pq.top();pq.pop();
    if(dp[v][g] < t)continue;
    push(t+d[v],v,min<int32>(g+c[v],2500));
    for(auto [u,a,b] : adj[v]){
      if(g - a >= 0)
        push(t+b,u,g-a);
    }
  }
  FOR(i,1,n){
    int64 ans = LLINF;
    REP(j,2505){
      ans = min(ans, dp[i][j]);
    }
    ANS(ans);
  }
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  int n = s.size();
  int ans = 1000;
  for(int i = 0; i < n-2; i++){
    int k = (s.at(i) - '0') * 100 + (s.at(i+1) - '0') * 10 + s.at(i+2) - '0';
    ans = min(ans, abs(753 - k));
  }
  
  cout << ans << endl;
}

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

int main(){
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3620
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

const nmax = 8

var graph = [nmax][nmax]bool{}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	m := nextInt()

	for i := 0; i < m; i++ {
		a := nextInt()
		b := nextInt()
		graph[a-1][b-1] = true
		graph[b-1][a-1] = true
	}

	var visited = [nmax]bool{}
	visited[0] = true

	ans := dfs(0, n, visited)
	fmt.Println(ans)
}

func dfs(v, N int, visited [nmax]bool) int {
	allVisited := true
	for i := 0; i < N; i++ {
		if visited[i] == false {
			allVisited = false
		}
	}

	if allVisited {
		return 1
	}

	ret := 0

	for i := 0; i < N; i++ {
		if !graph[v][i] {
			continue
		}
		if visited[i] {
			continue
		}

		visited[i] = true
		ret += dfs(i, N, visited)
		visited[i] = false
	}

	return ret
}


Measured memory_bytes: 640
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

K = int(input())
S = str(input())

ans = ""
if len(S) <= K:
    ans = S
else:
    ans = S[:K] + "..."

print(ans)

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x;
string s;

// <---------------------- > //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	map<ll,ll> val;
	ll sum = 0;
	for(ll i=0;i<n;i++) {
		cin>>x;
		sum += x;
		val[x]++;
	}	
	cin>>q;

	while(q--) {
		ll b,c;
		cin>>b>>c;
		if(val[b] != 0) {
			ll cou = val[b];
			val[c] += val[b];
			val[b] = 0;
			ll diff = c-b;

			sum += cou*diff;
		}
		cout<<sum;newl;
	}
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {

		MAIN();
	}
	return 0;
}


Measured memory_bytes: 9388
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	static class Card {
		String mark;
		int num;
		public Card(String mark, int num) {
			this.mark = mark;
			this.num = num;
		}
		public String toString() {
			return String.format("%s %d", mark, num);
		}
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		Card[] cards1 = new Card[n];
		Card[] cards2 = new Card[n];
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(reader.readLine());
			String mark = st.nextToken();
			int num = Integer.parseInt(st.nextToken());
			cards1[i] = new Card(mark, num);
			cards2[i] = new Card(mark, num);
		}
		reader.close();
		
		quickSort(cards1, 0, n - 1);
		mergeSort(cards2, 0, n);
		boolean stable = checkStability(cards1, cards2);
		if (stable) {
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}		
		for (Card card : cards1) {
			System.out.println(card);
		}
	}

	private static boolean checkStability(Card[] cards1, Card[] cards2) {
		for (int i = 0; i < cards1.length; i++) {
			if (cards1[i].num == cards2[i].num) {
				if (!cards1[i].mark.equals(cards2[i].mark)) {
					return false;
				}
 			}
		}
		return true;
	}

	private static void mergeSort(Card[] cards, int left, int right) {
		if (left + 1 < right) {
			int mid = left + (right - left) / 2;
			mergeSort(cards, left, mid);
			mergeSort(cards, mid, right);
			merge(cards, left, mid, right);
		}
	}

	private static void merge(Card[] cards, int left, int mid, int right) {
		int n1 = mid - left;
		int n2 = right - mid;
		Card[] L = new Card[n1 + 1];
		Card[] R = new Card[n2 + 1];
		for (int i = 0; i < n1; i++) {
			L[i] = cards[left + i];
		}
		for (int i = 0; i < n2; i++) {
			R[i] = cards[mid + i];
		}
		L[n1] = new Card("X", Integer.MAX_VALUE);
		R[n2] = new Card("X", Integer.MAX_VALUE);
		int i = 0;
		int j = 0;
		for (int k = left; k < right; k++) {
			if (L[i].num <= R[j].num) {
				cards[k] = L[i];
				i++;
			} else {
				cards[k] = R[j];
				j++;
			}
		}
	}

	private static void quickSort(Card[] cards, int p, int r) {
		if (p < r) {
			int q = partition(cards, p, r);
			quickSort(cards, p, q - 1);
			quickSort(cards, q + 1, r);
		}
	}

	private static int partition(Card[] cards, int p, int r) {
		int x = cards[r].num;
		int i = p - 1;
		for (int j = p; j < r; j++) {
			if (cards[j].num <= x) {
				i ++;
				swap(cards, i, j);
			}
		}
		swap(cards, i + 1, r);
		return i + 1;
	}

	private static void swap(Card[] cards, int i, int j) {
		Card tmp = cards[i];
		cards[i] = cards[j];
		cards[j] = tmp;
	}	
}



Measured memory_bytes: 148060