akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//↑templete
#define double long double
double dist(pair<double, double> A, pair<double, double> B){
	double a=A.first-B.first, b=A.second-B.second;
	return sqrt(a*a+b*b);
}
signed main(){
	cout<<setprecision(20)<<fixed;

	int N;
	cin>>N;
	vector<pair<double, double>> X;
	for(int i=0;i<N;i++){
		int x, y;
		cin>>x>>y;
		X.eb(x, y);
	}

	if(N==2){
		cout<<dist(X[0], X[1])/2.<<endl;
		return 0;
	}

	double ans=1.0*INF;
	double EPS=1e-8;

	for(int i=0;i<N;i++){
		for(int j=0;j<i;j++){

			if(i==j)
				continue;
			
			//中点
			pair<double, double> ce=mp((X[i].first+X[j].first)/2, (X[i].second+X[j].second)/2);
			double rr=dist(X[i], X[j])/2;

			bool fla=1;
			for(int l=0;l<N;l++){
				if(dist(ce, X[l]) > rr+EPS)
					fla=0;
			}
			if(fla)
				ans=min(ans, rr);

			for(int k=0;k<j;k++){
				if((i==j) || (j==k) || (k==i))
					continue;

				double a=dist(X[j], X[k]), b=dist(X[k], X[i]), c=dist(X[i], X[j]);
				double alpha=a*a*(b*b+c*c-a*a), beta=b*b*(c*c+a*a-b*b), gamma=c*c*(a*a+b*b-c*c);
				double x=(alpha*X[i].first+beta*X[j].first+gamma*X[k].first)/(alpha+beta+gamma);	//外心の座標
				double y=(alpha*X[i].second+beta*X[j].second+gamma*X[k].second)/(alpha+beta+gamma);
				pair<double, double> cen=mp(x, y);

				//cout<<x<<" "<<y<<endl;

				//外接円の半径
				double r=a*b*c/sqrt((a+b+c)*(-1*a+b+c)*(a-b+c)*(a+b-c));

				//すべての円が円に入っているか？
				//cout<<r<<endl;
				bool flag=1;
				for(int l=0;l<N;l++){
					if(dist(cen, X[l]) > r+EPS)
						flag=0;
				}
				if(flag)
					ans=min(ans, r);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int i;
			String ret = "";
			for (i = 0; i < input.length(); i++) {
				String c = input.substring(i, i + 1);
				if (c == c.toLowerCase()) {
					ret = ret + c.toUpperCase();
				} else {
					ret = ret + c.toLowerCase();
				}
			}
			System.out.println(ret);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24104
#include "bits/stdc++.h"
using namespace std;

#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n";
#define all(a)  (a).begin(),(a).end();
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

class Modulo{
public:
    ll val;
    static const ll mod = 1e9+7;
    vector<ll> factable = {1};
    vector<ll> invtable = {1};
    ll pro(ll x,ll y){return ((x%mod)*(y%mod))%mod;}
    ll sum(ll x,ll y){return ((x%mod)+(y%mod))%mod;}
    ll dif(ll x,ll y){ll d =((x%mod)-(y%mod))%mod;if(d>=0){return d;}else{return d+mod;}}
    ll quo(ll x, ll y){return pro(x,pow(y,mod-2));}
    ll pow(ll x,ll y){
        if(y<=0){return 1;}
        if(y%2==0){ll d = pow(x,y/2);return ((d%mod)*(d%mod))%mod;}
        else{return (x*pow(x,y-1))%mod;}
    }
    void operator=(ll n){this->val = n%mod;}
    ll operator+(ll n){return sum(this->val,n);}
    ll operator-(ll n){return dif(this->val,n);}
    ll operator*(ll n){return pro(this->val,n);}
    ll operator/(ll n){return quo(this->val,n);}
    void operator+=(ll n){this->val = sum(this->val,n);}
    void operator-=(ll n){this->val = dif(this->val,n);}
    void operator*=(ll n){this->val = pro(this->val,n);}
    void operator/=(ll n){this->val = quo(this->val,n);}
    ll fac(ll x){
        //x! mod mod
        if(factable.size()<=x){
            ll s = factable.size();
            FOR(i,s,x+1){
                factable.push_back(pro(i,factable.back()));
                invtable.push_back(quo(1,factable.back()));
            }
        }
        if(x<0) return 1;
        else return factable[x];
    }
    ll facinv(ll x){
        if(invtable.size()<=x){
            ll s = invtable.size();
            FOR(i,s,x+1){
                factable.push_back(pro(i,factable.back()));
                invtable.push_back(quo(1,factable.back()));
            }
        }
        if(x<0) return 1;
        else return invtable[x];
    }
    ll com(ll x,ll y){
        //xCy mod mod = x!/((x-y)!*y!) mod mod
        if(x-y<y)return com(x,x-y);
        return pro(fac(x),pro(facinv(x-y),facinv(y)));
    }
};
ll n,m;
//const int MOD = 1e9+7;

int main(){
    cin >> n >> m;
    if(abs(n-m)>1){
        put(0);
        return 0;
    }
    Modulo mo;
    mo.val = 1;
    if(n-m==1){
        mo*=mo.fac(n);
        mo*=mo.fac(m);
    }else if(m-n==1){
        mo*=mo.fac(n);
        mo*=mo.fac(m);
    }else{
        mo*=mo.fac(n);
        mo*=mo.fac(m);
        mo*=2;
    }
    put(mo.val);
    return 0;
}


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

const int nm = 1e3, mod = 1e9 + 7;
int n, a[nm + 1];

int main() {
	cin >> n;
	for (int i = 2, m; i <= n; i++) {
		m = i;
		for (int j = 2; m > 1 && j * j <= m; j++)
			while (!(m % j))
				m /= j, a[j]++;
		a[m]++;
	}

	long long rv = 1;
	for (int i = 2; i <= nm; i++)
		if (a[i])
			rv = rv * (a[i] + 1) % mod;
	cout << rv << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,n) for(int i=l; i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
using Graph = vector<vector<int>>;

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

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    REP(i,N){
        int u,k; cin >> u >> k;
        REP(i,k){
            int vlist; cin >> vlist;
            G[u-1].push_back(vlist-1);
        }
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    for (int v = 0; v < N; ++v) cout << v+1 << " " << dist[v] << endl;
}


Measured memory_bytes: 3160
N=int(input())
K=[int(input()) for i in range(N)]
L=set()
L.add(0)
for i in range(N):
    S=set()
    for s in L:
        S.add(s)
        S.add(s+K[i])
    L=S
L=sorted(list(L),reverse=True)
ans =0
for l in L:
    if l%10==0:
        continue
    ans=l
    break
print(ans)

Measured memory_bytes: 52572
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::vector;
using std::queue;
using std::priority_queue;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

ulli N, M, a, b;
vector<ulli> G[200010];
bool f[200010], flag;

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
	cin >> N >> M;
	for(ulli i = 0; i < M; i++){
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for(auto i : G[1]){
		f[i] = true;
	}
	for(auto i : G[N]){
		if(f[i]){
			flag = true;
			break;
		}
	}
	if(flag) cout << "POSSIBLE\n";
	else cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 12904
#include<iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int A[N];
    int max = 0, second = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(A[i] > max) {
            second = max;
            max = A[i];
        } else if(A[i] > second) {
            second = A[i];
        }
    }

    for(int i = 0; i < N; i++) {
        if(A[i] != max) {
            cout << max << endl;
        } else {
            cout << second << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rev(i,n,a) for(ll i=n-1;i>=a;i--)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>
#define vpll vector<pll>
#define pll pair<ll,ll>
#define secreterror() ios_base::sync_with_stdio(false);cin.tie(NULL);

ll n,m,k;
ll sx,sy;
ll fx,fy;

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

vector<vector<char>>adj;
vector<vector<ll>>dis;

bool isValid(ll x,ll y){
    return x>=0&&x<n&&y>=0&&y<m;
}

ll bfs(){

    dis[sx][sy]=0;


    queue<pll>q;
    q.push({sx,sy});


    while(!q.empty()){

        // cout<<"hree"<<endl;

        pll curr=q.front();
        q.pop();

        if(curr.f==fx&&curr.s==fy){
            return dis[curr.first][curr.s];
        }

        for(int i=0;i<4;i++){

            for(int j=1;j<=k;j++){
                ll x=curr.f+dx[i]*j;
                ll y=curr.s+dy[i]*j;

                if(isValid(x,y)){

                    if(adj[x][y]!='.'||dis[x][y]<=dis[curr.f][curr.s]){
                        break;
                    }

                    if(dis[x][y]>dis[curr.f][curr.s]+1){
                        dis[x][y]=dis[curr.f][curr.s]+1;
                        q.push({x,y});
                    }
                }




            }

        }
    }

    return -1;

}


void solve(){

    cin>>n>>m>>k;
    cin>>sx>>sy>>fx>>fy;
    sx--;
    sy--;
    fx--;
    fy--;

    adj=vector<vector<char>>(n,vector<char>(m));
    dis=vector<vector<ll>>(n,vector<ll>(m,1e18));

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

    cout<<bfs()<<endl;


    
}


int main()
{
    secreterror()
    // ll t;
    // cin>>t;
    //while(t--){
        solve();
        
    //}

}

Measured memory_bytes: 19924
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main(){
    int a[6];
    for(int i=0; i<6; i++){
        cin >> a[i];
    }
    bool hantei=false;
    for(int i=0; i<4; i++){
        for(int j=i+1; j<5; j++){
            if(a[j]-a[i]>a[5]){
                hantei = true;
            }
        }
    }
    if(!hantei){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30);
#define ll long long
#define pi 3.14159265359
using namespace std;

int main()
{
    IOS;
    int k,s=0;
    cin>>k;
    for(int i=1;i<=1000000;i++){
        s=(s*10+7)%k;
        if(!s) return cout<<i,0;
    }
    return cout<<-1,0;
}


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

int main(void)
{
	ll n,i;
	cin>>n;
	ll A[n][3];
	for(i=0;i<n;i++)
	{
		cin>>A[i][0]>>A[i][1]>>A[i][2];
		
	}

	for(i=1;i<n;i++)
	{
		A[i][0]+=max(A[i-1][1],A[i-1][2]);
		A[i][1]+=max(A[i-1][0],A[i-1][2]);
		A[i][2]+=max(A[i-1][0],A[i-1][1]);
	}
	
	ll a=max(A[n-1][0],A[n-1][1]);
	a=max(a,A[n-1][2]);
	
	cout<<a;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

long long  mod = 1000000007;


int main(){
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i,n){
		cin >> a[i];
	}
	int k =a[0];
	bool flag = 1;
	rep(i,n){
		if(i==0)continue;		
		if(k!=a[i])flag = 0;
	}
	if(flag){
		cout << 0 << endl;
		return 0;
	}
	int x;
	int ma = 0;
	rep(i,n){
		if(ma<abs(a[i])){
			ma = abs(a[i]);
			x = i;
		}
	}
	vector<pair<int,int> > ans;
	if(a[x]>0){
		rep(i,n){
			if(i==x)continue;
			ans.PB(MP(x+1,i+1));
			a[i] += a[x];
		}
		for(int i=0;i<n-1;i++){
			ans.PB(MP(i+1,i+2));
			a[i+1] += a[i];
		}
	}else{
		rep(i,n){
			if(i==x)continue;
			ans.PB(MP(x+1,i+1));
			a[i] += a[x];
		}
		for(int i=n-1;i>0;i--){
			ans.PB(MP(i+1,i));
			a[i-1] += a[i];
		}
	}
	cout << ans.size() <<endl;
	for(int i=0;i<ans.size();i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	// for(int i=0;i<n;i++){
	// 	cout << a[i] << " ";
	// }
	// cout << endl;
	return 0;
}

Measured memory_bytes: 256
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const [n, A, B, C] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const [, ...rest] = stdin.split('\n')

const ls = rest.filter(e => e).map(Number)

function dfs(current, a, b, c) {
  if (current === n) {
    if (a === 0 || b === 0 || c === 0) return Infinity
    return Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C)
  }

  const r0 = dfs(current + 1, a, b, c)
  const r1 = dfs(current + 1, a + ls[current], b, c) + 10
  const r2 = dfs(current + 1, a, b + ls[current], c) + 10
  const r3 = dfs(current + 1, a, b, c + ls[current]) + 10

  return Math.min(r0, r1, r2, r3)
}

console.log(dfs(0, 0, 0, 0) - 3 * 10)


Measured memory_bytes: 11912
$<.each do |line|
  stack = line.chomp.split
  #逆ポーランド記法
  n = stack.inject([]) do |s, x|
    s << (x =~ /\d/ ? x.to_f : eval(s.pop(2).join(x)))
  end
  puts sprintf("%.6f", n.first)
end

Measured memory_bytes: 6164
import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    pi = 0
    for n in range(1, N + 1):
        if n % K == 0:
            pi += 1

    hf = 0
    for n in range(1, N + 1):
        if n % K == K // 2:
            hf += 1

    ret = pi ** 3
    if K % 2 == 0:
        ret += hf ** 3
    print(ret)


if __name__ == '__main__':
    main()


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

int main(void){
    ll n,x;
    int i;
    cin >> n >> x;
    vector<ll> l(n);
    for(i=0;i<n;i++){
        cin >> l[i];
    }
    ll sum = 0;
    for(i=0;i<n;i++){
        sum += l[i];
        if(sum > x){
            break;
        }
    }
    cout << i+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=200100,P=200003;
const double pi=acos(-1);
int n,a[N],f[P],p[P];
int len,rev[P*4];
struct com
{
	long double real,ima;
}g[P*4];
com operator+(com a,com b){return(com){a.real+b.real,a.ima+b.ima};}
com operator-(com a,com b){return(com){a.real-b.real,a.ima-b.ima};}
com operator*(com a,com b){return(com){a.real*b.real-a.ima*b.ima,a.real*b.ima+b.real*a.ima};}
inline void change(int len)
{
	for (int i=0;i<len;i++)
	{
		rev[i]=rev[i>>1]>>1;
		if (i&1) rev[i]|=len>>1;
	}
}
inline void fft(com y[],int len,int v)
{
	for (int i=0;i<len;i++) if (i<rev[i]) swap(y[i],y[rev[i]]);
	for (int i=2;i<=len;i<<=1)
	{
		com step=(com){cos(2.0*pi/i),sin(v*2.0*pi/i)};
		for (int j=0;j<len;j+=i)
		{
			com x=(com){1.0,0};
			for (int k=j;k<j+i/2;k++)
			{
				com a=y[k],b=x*y[k+i/2];
				y[k]=a+b,y[k+i/2]=a-b;
				x=x*step;
			}
		}
	}
	if (v==-1) for (int i=0;i<len;i++) y[i].real/=1.0*len;
}
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	f[1]=0;
	int x=1;
	for (int i=1;i<P-1;i++) x=(x+x)%P,f[x]=i;
	p[0]=1;
	for (int i=1;i<P-1;i++) p[i]=(p[i-1]+p[i-1])%P;
	for (int i=1;i<=n;i++) if (a[i]!=0) g[f[a[i]]].real+=1;
	len=1;
	while (len<P+P) len<<=1;
	change(len);
	fft(g,len,1);
	for (int i=0;i<len;i++) g[i]=g[i]*g[i];
	fft(g,len,-1);
	for (int i=1;i<=n;i++) if (a[i]!=0) g[f[a[i]]*2].real-=1;
	int ans=0;
	for (int i=0;i<len;i++) ans+=p[i%(P-1)]*((int)(g[i].real+0.5)/2);
	printf("%lld\n",ans);
}


Measured memory_bytes: 29276
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

int main(){
  int a, b, c, k;cin>>a>>b>>c>>k;
  if(a<b)swap(a, b);
  if(a<c)swap(a, c);
  cout << a*pow(2, k) + b + c << endl;
}


Measured memory_bytes: 256
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
/* contest template */

int main()
{
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	bool flag = true;
	for (int i = 0; i < a + b + 1; i++) {
		if (i == a) {
			if (s[i] != '-') {
				flag = false;
			}
		}
		else {
			if (s[i] < '0') {
				flag = false;
			}
			else if (s[i] > '9') {
				flag = false;
			}
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
typedef long long ll;
int n, m;

char ch[maxn];
int ar[maxn];
int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)scanf("%d", ar + i);
    int ans = 1e9 + 1;
    for(int i = 1; i <= 100; i++){
        int x = 0;
        for(int j = 1; j <= n; j++)x += (i - ar[j]) * (i - ar[j]);
        ans = min(ans, x);
    }
    printf("%d\n", ans);

    return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
	string s; cin >> s;
	for(auto &i : s) i -= 'a';

	int ans = 1e9;

	for(int i = 0; i < 26; i++) {
		if(count(s.begin(), s.end(), i) == 0) continue;
		string t = s;
		int cnt = 0;

		while((int)t.size() != count(t.begin(), t.end(), i) && t.size()) {
			string td = t;
			int nn = t.size();
			td.pop_back();
			for(int j = 0; j < nn - 1; j++) {
				if(t[j] == i || t[j + 1] == i) {
					td[j] = i;
				}
			}
			t = td;
			cnt++;

		}
		ans = min(cnt ,ans);
	}
	cout << ans << endl;

}

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

int main(){
    int L, R;
    cin >> L >> R;
    int ans = 2020;

    if(R-L>=2019) ans = 0;
    else{
        for (int i = L; i <= R; i++)
        {
            for (int j = i; j <= R; j++)
            {
                if(i!=j){
                    ans = min(ans,((i%2019)*(j%2019))%2019);
                }
            }
            
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair

int mod = 1e9+7;
int inf = 1e18;
const int N = 3e5+5;
int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
      string s;
      cin>>s;
      int a = 0;
      int b =  0;
      rep(i,0,3)
      {
          if(s[i]=='A')
            a++;
          else
            b++;
      }
      if(a==3||b==3)
        cout<<"No";
      else
        cout<<"Yes"<<el;


    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
    int l;
  	//float v;
  	cin >> l;
  	//v = (l / 3.0) * (l / 3.0) * (l / 3.0);
    printf("%f\n", (l / 3.0) * (l / 3.0) * (l / 3.0));
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  ll A,B,N;
  cin>>A>>B>>N;
  ll r=min(B-1,N);
  cout<<r*A/B<<endl;

  return 0;
}


Measured memory_bytes: 3608
N = gets.to_i
f = []
profits = []

N.times do
  f << gets.split.join.to_i(2)
end
N.times do
  profits << gets.split.map(&:to_i)
end

result = []
1.upto(1023) do |i|
  sum = 0
  f.each_with_index do |fv, j|
    d = (fv & i)
    sum += profits[j][d.to_s(2).chars.map(&:to_i).inject(:+)]
  end
  result << sum
end

p result.max




Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
int wei(int x){
	int t=0;
	while(x){
		t++;
		x/=10;
	}
	return t;
}
bool pan(int x){
	int p=sqrt(x);
	return p*p==x;
}
int main(){
	int a,b;
	cin>>a>>b;
    for(int i=1;i<=wei(b);i++){
    	a*=10;
	}
	if(pan(a+b)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}		 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cassert>
using namespace std;

int lg2(int n){
	if( n == 0 || n % 2 == 1) return 0;
	if( n % 2 == 0 ) return 1 + lg2(n/2);
}

int main(){
	long long N, M;
	cin >> N >> M;
	
	vector<long long> A(N);
	
	set<int> S;
	for(int i = 0 ; i < N ; i++) {
		cin >> A[i];
		S.insert(lg2(A[i]));
	}
	
	if( S.size() > 1 ){
		cout << 0 << endl;
		return 0;
	}
	
	
	long long lcm = 1;
	for(long long a : A ){
		lcm = a / __gcd(lcm, a) * lcm; 
		if( lcm > 1e10 ){
			cout << 0 << endl;
			return 0;
		}
	}
	
	
	if( M <	lcm / 2 ) {
		cout << 0 << endl;
		return 0;
	}
	assert(lcm%2==0);
	cout << (M - lcm / 2) / lcm + 1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAX_N=1<<18;
typedef long long ll;
int n;
ll dat[2*MAX_N-1];
int m,h[200000];
ll dp[200001]={},a[200000],ans=0;
void init(int n_){
    n=1;
    while(n<n_){
        n*=2;
    }
    for(int i=0;i<2*n-1;i++){
        dat[i]=0;
    }
}

void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
}

ll query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l){
        return 0;
    }
    if(a<=l&&r<=b){
        return dat[k];
    }
    else{
        ll vl=query(a,b,k*2+1,l,(l+r)/2);
        ll vr=query(a,b,k*2+2,(l+r)/2,r);
        return max(vl,vr);
    }
}

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
        h[i]--;
    }
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    m=n;
    init(n);
    for(int i=0;i<m;i++){
        dp[h[i]]=a[i]+query(0,h[i],0,0,n);
        update(h[i],dp[h[i]]);
    }
    for(int i=0;i<m;i++){
        ans=max(ans,dp[i]);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 8320
#include <stdio.h>

int main(void) {
    int w, n, a, b, i, t;
    int c[31];

    scanf("%d", &w);
    scanf("%d", &n);
    for (i = 1; i <= w; i++) {
        c[i] = i;
    }
    for (i = 0; i < n; i++) {
        scanf("%d,%d", &a, &b);
        t = c[a];
        c[a] = c[b];
        c[b] = t;
    }
    for (i = 1; i <= w; i++) {
        printf("%d\n", c[i]);
    }

    return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int compare(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

void Mysort(void* arr, int len, long unsigned int size){
    qsort(arr, len, size, compare);
}

int main(void){
    int r, d, x;
    scanf("%d%d%d", &r, &d, &x);
    for(int i=0;i<10;i++){
        x = r*x-d;
        printf("%d\n", x);
    }
    return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
    string s, t;
    cin >> s >> t;
    rep(i, s.length()){
        s = s[s.length()-1]+s.substr(0, s.length()-1);
        if ( s == t ) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll n, m, a, dp[100010];
string s[2010];
bool ju[100010];

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}

int main(void)
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> a;
		ju[a] = true;
	}
	dp[0] = 1;
	if (!ju[1])
	{
		dp[1] = 1;
	}
	for (int i = 2; i <= n; i++)
	{
		if (!ju[i])
		{
			dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
		}
	}
	cout << dp[n] << endl;
	int www;
	cin >> www;
}


Measured memory_bytes: 1152
#include <cstdio>
int n, Log[1005];
int main(){
    scanf("%d", &n);
    Log[1] = 0;
    for (register int i = 2; i <= n * 2; ++i) Log[i] = Log[i >> 1] + 1;
    for (register int i = 0; i < n; ++i)
        for (register int j = i + 1; j < n; ++j)
            printf("%d", Log[i ^ j] + 1), putchar(" \n"[j == n - 1]);
}

Measured memory_bytes: 384
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    N = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    C = list(map(int,input().split()))
    prev = A[0]
    ans = B[A[0]-1]
    for i in range(1,N):
        if A[i]-1 == A[i-1]:
            ans += C[A[i-1]-1]
        ans += B[A[i]-1]
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 38448
#!/usr/bin/env python3

from collections import deque
from queue import PriorityQueue


def solve(N, M, A, B):
    ans = 0
    # 日付順にソートする
    all_works = deque(sorted(zip(A, B), key=lambda x: x[0]))
    pq = PriorityQueue(maxsize=N)

    for d in range(1, M+1):
        # print('d=', d)
        # 今日が期限の仕事があれば追加
        while all_works and all_works[0][0] == d:
            work = all_works.popleft()
            # 最小値優先なのでマイナスをつける
            pq.put_nowait(-work[1])
        if not pq.empty():
            work = pq.get_nowait()
            ans -= work

    return ans


if __name__ == '__main__':
    N, M = map(int, input().split())
    A = [0] * N
    B = [0] * N
    for idx in range(N):
        A[idx], B[idx] = map(int, input().split())

    ans = solve(N, M, A, B)

    print(ans)


Measured memory_bytes: 22160
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<bool> a(N+1, false), b(N+1, false);
  for(int i=0;i<M;i++){
    int f, t;
    cin >> f >> t;
    if(f == 1)a[t] = true;
    if(t == N)b[f] = true;
  }
  string ans = "IMPOSSIBLE";
  for(int i=2;i<N;i++)
    if(a[i]&&b[i])ans = "POSSIBLE";
  cout << ans << endl;
}


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

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

int n, l;
int h[100002];
int dp[100002];

int solve(int pos) {
	if (dp[pos] > 0) return dp[pos];

	int t = l - h[pos];

	dp[pos] = t;
	if (h[pos - 1] > h[pos])
		dp[pos] = max(dp[pos], solve(pos - 1) + t);
	if (h[pos + 1] > h[pos])
		dp[pos] = max(dp[pos], solve(pos + 1) + t);

	return dp[pos];
}

int main() {
	cin >> n >> l;
	h[0] = 0;
	REP(i, n) scanf("%d", &h[i + 1]);
	h[n + 1] = 0;
	n += 2;

	int ans = 0;
	FOR(i, 1, n - 1) ans = max(ans, solve(i));

	cout << ans << endl;

	return 0;
}

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

int N;
vector<int> H;

int main(void) {
	cin >> N;
	H.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> H[i];

	int cnt = 0;
	int max_h = 0;
	for (int i = 0; i < N; ++i) {
		if (H[i] >= max_h) {
			++cnt;
			max_h = H[i];
		}
	}

	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 256
while True:
    n, m, a = map(int, input().split(' '))
    if n == 0 and m == 0 and a == 0:
        break
    hl = [list(map(int, input().split(' '))) for i in range(m)]
    hl.sort(key=lambda x: x[0], reverse=True)
    vl = a
    for l in hl:
        if l[1] == vl:
            vl = l[2]
        elif l[2] == vl:
            vl = l[1]
    print(vl)

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

int main(){
int flag=0,n;
string s;
cin>>s;
n=s.size();
if(n%2==0){
    cout<<"No"<<endl;
    return 0;
}
for(int i=0;i<n;i++)
    if(s[i]!=s[n-i-1])
    flag=1;
for(int i=0;i<n/2;i++)
    if(s[i]!=s[n/2-i-1]){
    flag=1;
    }
for(int i=n-1;i>n/2;i--)
    if(s[i]!=s[(3*n-1)/2-i]){
    flag=1;
    }
if(flag)
    cout<<"No"<<endl;
else
    cout<<"Yes"<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int visited[8];
int n[8][8];
int ans;
int N, M;

void dfs(int s, int cnt){
    if(cnt==N){
        ans ++;
        return;
    }
    visited[s]=1;
    for(int i=0; i<N; i++){
        if(n[s][i] && !visited[i]){
            dfs(i, cnt+1);
        }
    }
    visited[s]=0;
}

int main() {
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        n[a][b]=n[b][a]=1;
    }
    ans = 0;
    dfs(0, 1);
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    //freopen("input.txt","r",stdin);
	//freopen("new.txt","w",stdout);
	
	int k;
	cin>>k;
	int sum =7;
	for(int i=1;i<=1e7;i++)
	{
		sum = sum%k;
		if(sum==0)
		{
			cout<<i;
			return 0;
		}
		sum = (sum*10)+7;
	}
	cout<<"-1";
    return 0;
}

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

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

const int MAX = 1e9;
const int N = 1010;

int H,W,h,w,a[N][N];

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

    cin >> H >> W >> h >> w;

    bool ok = false;
    if (H%h) {
        ok = true;
        for (int i = 0; i < H; i += h) forn(j,W) {
            a[i][j] = MAX-1;
            a[i+h-1][j] = -MAX;
        }
    }
    else if (W%w) {
        ok = true;
        for (int j = 0; j < W; j += w) forn(i,H) {
            a[i][j] = MAX-1;
            a[i][j+w-1] = -MAX;
        }
    }

    if (ok) {
        cout << "Yes\n";
        forn(i,H) { forn(j,W) cout << a[i][j] << ' '; cout << endl; }
    }
    else cout << "No\n";

    return 0;
}


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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	string s = "";
	s += S[0];
	for (int i = 1; i < (int)S.length(); ++i){
		if (S[i-1] != S[i]){
			s += S[i];
		} // end if
	} // end for

	int res = (int)s.length() - 1;
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int L,n;
ll K;
#define Maxn 100010
ll A[Maxn];
ll  dp[60][2];
int num[Maxn][60];
int main(){
	scanf("%d%lld",&n,&K);
	ll tmp=K;
	int C=0;
	while(tmp){
		if(tmp&1)num[0][++C]=1;
		else num[0][++C]=0;
		tmp>>=1;
	}
	L=max(L,C);
	for(register int i=1;i<=n;++i){
		scanf("%lld",&A[i]);
		tmp=A[i];C=0;
		while(tmp){
			if(tmp&1)num[i][++C]=1;
			else num[i][++C]=0;
			tmp>>=1;
		}
		L=max(L,C);
	}
	for(register int i=1;i<=L;++i){
		//0
		ll res1=0,res2=0;
		for(register int j=1;j<=n;++j)
		    if(num[j][i])res1+=(1ll<<(i-1));
		res1+=dp[i-1][0];
		for(register int j=1;j<=n;++j)
		    if(!num[j][i])res2+=(1ll<<(i-1));
		res2+=dp[i-1][0];
		dp[i][0]=max(res1,res2);
		//1
		if(num[0][i]){
			res1=0,res2=0;
			for(register int j=1;j<=n;++j)
			    if(num[j][i])res1+=(1ll<<(i-1));
			res1+=dp[i-1][0];
			for(register int j=1;j<=n;++j)
			    if(!num[j][i])res2+=(1ll<<(i-1));
			res2+=dp[i-1][1];
			dp[i][1]=max(res1,res2); 
		}else{
			for(register int j=1;j<=n;++j)
			    if(num[j][i])dp[i][1]+=(1ll<<(i-1));
			dp[i][1]+=dp[i-1][1];
		}
	}
	printf("%lld\n",dp[L][1]);
	return 0;
}

Measured memory_bytes: 24448
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    s = S()
    if s[2] == s[3] and s[4] == s[5]:
        print('Yes')
    else:
        print('No')
    return


if __name__ == "__main__":
    solve()

Measured memory_bytes: 38256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n,a,b,c,x;
  while(cin>>n>>a>>b>>c>>x,n||a||b||c||x){
    int co=0;
    while(n--){
      int m;cin>>m;
      while(x!=m){
	x=(a*x+b)%c;
	co++;
	if(co>10001)break;
      }
      if(co>10001)break;
      x=(a*x+b)%c;
      co++;
    }
    if(co<=10001)co--;
    while(n-->0)cin>>a;
    if(co>10000)cout<<-1<<endl;
    else cout<<co<<endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int>A(N);
  for(int i =0; i<N; i++)cin >> A.at(i);
  
  vector<int>B(100011);
  for(int i=0; i<N; i++){
    B.at(A.at(i)) ++;
    B.at(A.at(i)+1) ++;
    B.at(A.at(i)+2) ++;
  }
  
  sort(B.begin(), B.end());
  cout << B.at(100010) << endl;
  
}

Measured memory_bytes: 4060
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    cin >> N;
    int max_n = 0;
    for(int i = 0; i < 7; i++){
        if(pow(2, i) <= N) max_n = max(max_n, (int)pow(2, i));
    }
    cout << max_n << endl;
}


Measured memory_bytes: 4008
s = input()
l = len(s)
idx = []
for i in range(l-1):
    if s[i] == ">" and s[i+1] == "<":
        idx.append(i+1)

idx = [0]+idx+[l]

L = []
cnt = 0
for i in range(len(idx)-1):
    L = s[idx[i]:idx[i+1]]

    for j in range(len(L)):
        a = L.count("<")
        b = L.count(">")
        k = max(a,b)
        r = min(a,b)
    if r >=1:
        cnt += k*(k+1)//2 + r*(r-1)//2
    else:
        cnt += k*(k+1)//2

print(cnt)

Measured memory_bytes: 79112
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

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

    string s;
    cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';
    if      ((a+b+c+d)==7) cout <<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    else if ((a+b+c-d)==7) cout <<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    else if ((a+b-c+d)==7) cout <<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    else if ((a-b+c+d)==7) cout <<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    else if ((a+b-c-d)==7) cout <<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    else if ((a-b-c+d)==7) cout <<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    else if ((a-b+c-d)==7) cout <<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    else if ((a-b-c-d)==7) cout <<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
int p,q ,r, o1, o2, o3, o4;
int main(){
    scanf("%d%d%d", &p, &q, &r);
    o1=p+q;
    o2=r+q;
    o3=p+r;
    o4=q+p;
    printf("%d", min(o1, min(o2, min(o3, o4))));
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

// C - Stones
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();

		int black = 0;
		int white = 0;

		for (int i = 0; i < N; i++) {
			if (S.charAt(i) == '.') {
				white++;
			}
		}

		int min = white;

		for (int i = 0; i < N; i++) {
			if (S.charAt(i) == '#') {
				black++;
			} else {
				white--;
			}
			min = Math.min(min, black + white);
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 27372
#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 erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
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; }

bool cmp(P a,P b){return (a.second < b.second);};

signed main(){
  int n,m;
  cin >> n >> m;
  vector<P> bri(m);
  rep(i,0,m){
    cin >> bri[i].first >> bri[i].second; 
  }
  sort(bri.begin(),bri.end(),cmp);
  // rep(i,0,m){
    // cout << bri[i].first << " " << bri[i].second << endl;
  // }
  int ans = 0;
  int final = 0;
  rep(i,0,m){
    if(final <= bri[i].first){
      ans++;
      final = bri[i].second;
    }
  }
  cout << ans << endl;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll n, k, q; cin >> n >> k >> q;
    vector<ll> lis(n);
    REP(i, 0, q){
        ll a; cin >> a;
        lis[a-1]++;
    }
    REP(i, 0, n){
        if(k - (q-lis[i]) > 0){
            cout << "Yes" << endl;
        }else{ 
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1408
using System;
using System.Linq;

namespace _021_Parallelism
{
	class Program
	{
		static void Main ( string[] args )
		{
			int dataCount = int.Parse (Console.ReadLine ());

			for (int lp = 0; lp < dataCount; lp++)
			{
				decimal[] point = Console.ReadLine ().Split (' ').Select (str => decimal.Parse (str)).ToArray ();

				decimal gradient1;
				decimal gradient2;

				if (point[2] - point[0] != 0)
					gradient1 = (point[3] - point[1]) / (point[2] - point[0]);
				else
					gradient1 = decimal.MaxValue;

				if (point[6] - point[4] != 0)
					gradient2 = (point[7] - point[5]) / (point[6] - point[4]);
				else
					gradient2 = decimal.MaxValue;

				if (gradient1 == gradient2)
					Console.WriteLine ("YES");
				else
					Console.WriteLine ("NO");
			}
		}
	}
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<string> S(N);
	REP(i, N) cin >> S[i];

	auto isOk = [&](ll a) -> bool
				{
					vector<string> tmp(N);
					REP(i, N) tmp[i] = S[(i+a)%N];
					REP(h, N)REP(w, N)
						if (tmp[h][w] != tmp[w][h])
							return false;
					return true;
				};

	ll res{0};
	REP(h, N)
		res += isOk(h);
	std::cout << res*N<< std::endl;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
const int mod = 1000000007;
void add(int &a,int b){
    a = (a+b)%mod;
}
signed main(){
    int n,m;cin >>n >> m;
    vector<int> ng(n+1),dp(n+1);
    dp[0] = 1;
    rep(i,m){
        int x;cin >> x;
        ng[x] = 1;
    }
    
    rep(i,n){
        if(i+1 < n+1 && !ng[i+1])add(dp[i+1],dp[i]);
        if(i+2 < n+2 && !ng[i+2])add(dp[i+2],dp[i]);
    }
    cout << dp[n] << endl;
    return 0;
}

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


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

  vector<int> a( n+1 ) ;
  vector<int> b( n   ) ;
  rep( i, n+1 ) cin >> a[i] ;
  rep( i, n   ) cin >> b[i] ;
 
  //nが10^5、Aが10^9なので、桁数が10^14くらいになる。
  ll ans = 0 ;
  rep( i, n ) {
    int left = min(a[i], b[i]) ;
    ans += left ;
    a[i] -= left ;
    b[i] -= left ;

    int right = min( a[i+1], b[i]) ;
    ans += right ;
    a[i+1] -= right ;
    b[i] -= right ;
  }
  cout << ans << endl ;

  return 0 ;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>
 
using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll a, b, c;
    cin >> a >> b >> c;
    cout << ((b - a == c - b) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256