akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1005;
const ll INF=1LL<<60;
int V,match[MAX];//V=マッチングの左側
vector<int> G[MAX];
bool used[MAX];

void add_edge(int u,int v){
    G[u].push_back(v);
    G[v].push_back(u);
}//add_edge(u,100+v)のようにする

bool DFS(int v){
    used[v]=1;
    for(int i=0;i<G[v].size();i++){
        int u=G[v][i],w=match[u];
        if(w<0||(!used[w]&&DFS(w))){
            match[v]=u;
            match[u]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    memset(match,-1,sizeof(match));
    for(int v=0;v<V;v++){
        if(match[v]<0){
            memset(used,0,sizeof(used));
            if(DFS(v)) res++;
        }
    }
    return res;
}

void init(int si){
    for(int i=0;i<si;i++) G[i].clear();
    memset(used,0,si);
}

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

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M;cin>>N>>M;
        if(N+M==0) break;
        V=N;
        init(N+M);
        
        vector<int> A(N),B(M);
        for(int i=0;i<N;i++){
            cin>>A[i];
        }
        for(int i=0;i<M;i++){
            cin>>B[i];
        }
        
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(gcd(A[i],B[j])>1) add_edge(i,N+j);
            }
        }
        
        cout<<bipartite_matching()<<endl;
    }
    
}





Measured memory_bytes: 4860
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n,m = MI()
x = RI()

x.sort()
ls = []
for i in range(m-1):
    d = abs( x[i+1] - x[i] )
    ls.append(d)
ls.sort(reverse=True)
print(sum(ls[n-1:]))

Measured memory_bytes: 96012
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define forj(j,n) for(int j=n; j>=0; j--)
#define forx(x,v) for(auto &x:v)
#define sz(v) (int)(v).size()
#define rz(n) resize(n)
#define vec(x) vector < x >
using int64 = long long;
using vi = vector < int >;
using vi64 = vector < int64 >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
//const int64 biGinf = 9e+18;
const string yo = "Yes\n", no = "No\n";


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	string s;
	cin>>s;
	int64 k=0;
	for(char x : s){
		k += (int64)(x-'0');
	}

	if(k%9) cout<<no;
	else cout<<yo;




	return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>

using namespace std;


int main() {
	int r, c;
	int a[101][101];

	cin >> r >> c;
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> a[i][j];
		}
	}
	
	for (int i = 0; i < r; i++) {
		a[i][c] = 0;
		for (int j = 0; j < c; j++) {
			a[i][c] += a[i][j];
		}
	}
	for (int i = 0; i <= c; i++) {
		a[r][i] = 0;
		for (int j = 0; j < r; j++) {
			a[r][i] += a[j][i];
		}
	}
	for (int i = 0; i <= r; i++) {
		for (int j = 0; j <= c; j++) {
			cout << a[i][j];
			if (j < c) cout << ' ';
		}
		cout << endl;
	}
	cin >> r;
}

Measured memory_bytes: 1196
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int y[maxn],idx[maxn];
int ans[maxn];
int fa[maxn];
int pd(int x){
  if(x!=fa[x])fa[x] = pd(fa[x]);
  return fa[x];
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    int x,yy;
    cin>>x>>yy;
    y[x] = yy;
    idx[x] = i;
  }
  stack<pair<int,int>>st;
  for(int i=1;i<=n;i++){
    ans[i] = 1;
    fa[i] = i;
  };
  for(int i=1;i<=n;i++){
    auto pr = make_pair(y[i],i);
    while((!st.empty())&&st.top().first<y[i]){
      pr = min(pr, st.top());
      int pre = idx[st.top().second];
      int cur = idx[i];
      int fap = pd(pre);
      ans[cur] += ans[fap];
      fa[fap] = cur;
      st.pop();
    }
    st.push(pr);
  }
  for(int i=1;i<=n;i++){
    int tt = pd(i);
    ans[i] = ans[tt];
  }
  for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 11340
#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=200050;
const int p=1e9+7;
ll f[maxn],a[maxn];

int main()
{
	int n;
	ll ans=0;
	cin>>n;
	f[0]=0;
	for(int i=1;i<=n;++i)
	  {
	  	  cin>>a[i];
	  	  f[i]=(f[i-1]+a[i])%p;
	  }
	for(int i=1;i<n;++i)
	  {
	  	  ll k;
	  	  k=(p+f[n]-f[i])%p;
	  	  ans=(ans+k*a[i])%p;
	  }	  
	cout<<ans<<endl;  
}


Measured memory_bytes: 6752
import java.util.*;
class Main {
	public static void main(String[] a) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long sum=0;
		for(long i=1;i<=n;i++) {
			sum+=((n/i)*i+i)*(n/i)/2;
		}
		System.out.println(sum);
	}
}



Measured memory_bytes: 35444
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "l    ", long, "r");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto s = sread();
    // s[0 .. (s.length - 1) / 2].writeln();
    // s[(s.length + 3) / 2 - 1 .. $].writeln();
    if (s.is_reversable() && s[0 .. (s.length - 1) / 2].is_reversable()
            && s[(s.length + 3) / 2 - 1 .. $].is_reversable())
        writeln("Yes");
    else
        writeln("No");
}

bool is_reversable(string s)
{
    bool ret = true;
    foreach (i; iota(s.length / 2))
    {
        ret &= (s[i] == s[$ - 1 - i]);
    }
    return ret;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

long long N, A, B;
struct node {
    int x, y, id;
}P[maxn];

struct Edge {
    int u, v, w;
    bool operator < (const Edge& rhs) const {
        return w < rhs.w;
    }
}E[maxn];

bool cmp1(node a, node b) { return a.x < b.x; }
bool cmp2(node a, node b) { return a.y < b.y; }

int fa[maxn], cnt;
int find(int a) { return fa[a] == a ? a : fa[a] = find(fa[a]); }

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    cin >> N;
    REP(i, 0, N) fa[i] = i;
    REP(i, 0, N) {
        P[i].id = i;
        cin >> P[i].x >> P[i].y;
    }

    sort(P, P + N, cmp1);
    REP(i, 0, N-1) { E[cnt++] = (Edge) { P[i].id, P[i+1].id, P[i+1].x - P[i].x }; }

    sort(P, P + N, cmp2);
    REP(i, 0, N-1) { E[cnt++] = (Edge) { P[i].id, P[i+1].id, P[i+1].y - P[i].y }; }

    int ans = 0;
    sort(E, E + cnt);

    REP(i, 0, cnt) {
        int u = E[i].u, v = E[i].v;
        int fu = find(u), fv = find(v);
        if(fu != fv) {
            ans += E[i].w;
            fa[fu] = fv;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2944
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        var S = Reader.String();
        Console.WriteLine(S.Substring(0, S.Length - "FESTIVAL".Length));
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { Dispose(); A = new string[0]; }
    public static void Set(TextReader r) { Init(); reader = r; }
    public static void Set(string file) { Init(); reader = new StreamReader(file); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    public static void Dispose() { reader.Dispose(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < (int)n;i++)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int h[3][3] = {0};
    rep(i,3) rep(j,3) cin>> h[i][j];
    bool b[3][3] = {0};
    int N;
    cin >> N;
    int tmp;
    rep(i,N)
    {
        cin >> tmp;
        rep(j,3)
            rep(k,3)
                if(tmp == h[j][k])
                    b[j][k] = true;
    }

    bool is = false;
    rep(i,3)
    {
        if(b[i][0] and b[i][1] and b[i][2])
            is = true;
    }
    
    rep(i,3)
    {
        if(b[0][i] and b[1][i] and b[2][i])
            is = true;
    }

    if(b[0][0] and b[1][1] and b[2][2])
        is = true;
    
    if(b[0][2] and b[1][1] and b[2][0])
        is = true;

    cout << (is ? "Yes\n" : "No\n");
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  int s = vec.at(0);
  int i = 1;
   while (i < 100001) {
    if (s == 2) {
     break; 
    } 
    s = vec.at(s-1);
    i++;
   }
  
  if (i < 100000) {
    cout << i << endl;
  }
  else {
    cout << -1 << endl; 
  }
  
  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    string ans = "Yes";
    string t = s;
    reverse(t.begin(), t.end());
    if (s != t) {
        ans = "No";
    }
    string a, b;
    for (int i = 0; i < (n - 1) / 2; i++) {
        a.push_back(s[i]);
    }
    debug(a);
    b = a;
    reverse(b.begin(), b.end());
    if (a != b) {
        ans = "No";
    }
    a = b = "";
    for (int i = (n + 1) / 2; i < n; i++) {
        a.push_back(s[i]);
    }
    b = a;
    reverse(b.begin(), b.end());
    debug(a);
    if (a != b) {
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;

int main() {
    int n, m, t = 0;
    cin >> n >> m;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        t += v[i];
    }
    sort(v.rbegin(), v.rend());
    cout << (v[m - 1] < float(t) / (4 * m) ? "No" : "Yes");
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,d,i;
  d=0;
  scanf("%d%d%d",&a,&b,&c);
  for(i=a;i<=b;i++){
    if(c%i == 0)d++;
  }printf("%d\n",d);
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    ll n;
    cin>>n;
    int s = sqrt(n);
    vi ans(n+1,0);
    fo(i,1,s)
    {
      fo(j,1,s)
      {
        fo(k,1,s)
        {
          int z = i*i + j*j + k*k + i*j + j*k + k*i;
          if(z>n) break;
          ans[z]+=1;
        }
      }
    }
    fo(i,1,n+1) cout<<ans[i]<<"\n";
    return 0;
}

Measured memory_bytes: 3592
// 2014/07/11 Tazoe

#include <iostream>
using namespace std;

int gcd(int a, int b)
{
	if(b==0)
		return a;

	return gcd(b, a%b);
}

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

	int a;
	cin >> a;

	for(int i=1; i<n; i++){
		int b;
		cin >> b;

		a = gcd(a, b);
	}

	for(int i=1; i<=a; i++){
		if(a%i==0){
			cout << i << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
// 解き直し.
// https://img.atcoder.jp/arc075/editorial.pdf
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
LL p10[20];

int main(){
    
    // 1. 入力情報.
    LL D;
    scanf("%lld", &D);
    
    // 2. 10 の 冪乗.
    p10[0] = 1;
    rep(i, 19) p10[i + 1] = p10[i] * 10LL;
    // rep(i, 19) printf("%lld\n", p10[i]);
    
    // 3. D の 桁数.
    string strLD = to_string(D);
    int LD = strLD.size();
    
    // 4. L に対応する f(L, d) = D を 計算.
    // d[i] = n[i] - n[L - 1 - i] について, 以下のように解釈を追加する.
    // d[i] の 値 について, n[L - 1] が 0 でないことに注意して, 
    // ① i = 0 の 場合(※ 9 - d[i] 通り).
    // 0 … (1, 1), (2, 2), ..., (9, 9) の 9通り.
    // 1 … (2, 1), (3, 2), ..., (9, 8) の 8通り.
    // ...
    // 8 … (9, 1) の 1通り.
    // 9 … 0通り.
    // 
    // ② i > 0 の 場合(※ 10 - d[i] 通り).
    // 0 … (0, 0), (2, 2), ..., (9, 9) の 10通り.
    // 1 … (1, 0), (2, 1), ..., (9, 8) の 9通り.
    // ...
    // 8 … (9, 1), (8, 0) の 2通り.
    // 9 … (9, 0) の 1通り.
    // d[i] < 0 の 場合も, 絶対値を取って, d[i] > 0 の パターンに帰着.
    function<LL(LL, int, int, int, LL)> f = [&](LL dif, int L, int i, int u, LL ret) {
        // 4-1. 終了条件.
        if(u < i){
            // i の 2倍 が L 未満 の 場合, 10倍する必要があるように見える性質を仮定.
            LL d = (i * 2 < L) ? 10LL : 1LL;
            if(dif == 0) return ret * d;
            else         return 0LL;
        }
        
        // 4-2. 10 の 冪乗.
        LL tP10 = p10[L - 1 - i] - p10[i];
        
        // 4-3. d[i] の 値 を 検討.
        LL q = abs(dif) / tP10;
        // printf("1. L=%d i=%d u=%d tP10=%lld q=%lld dif=%lld\n", L, i, u, tP10, q, dif);
        
        // 4-4. D から 離れすぎている場合.
        if(q > 9){
            // printf("2. Too far away: i=%d u=%d tP10=%lld q=%lld dif=%lld\n", i, u, tP10, q, dif);
            return 0LL;
        }
        
        // 4-5. dif の 正負 で 分岐.
        int sign = (dif >= 0) ? 1 : -1;  // dif が 0 以上 か 0未満か.
        LL dx = (LL)(10 - q - (i == 0)); // i が 0 と等しい か 否か.
        LL dif1 = dif - tP10 * q * sign;
        LL dif2 = dif - tP10 * (q + 1) * sign;
        // printf("3. dif >= 0 i=%d dif=%lld dif1=%lld dif2=%lld\n", i, dif, dif1, dif2);
        if(q < 9) return f(dif1, L, i + 1, u, ret * dx) + f(dif2, L, i + 1, u, ret * (dx - 1LL));
        else      return f(dif1, L, i + 1, u, ret * dx);
        return 0LL;
    };
    LL ans = 0LL;
    repx(L, LD, LD * 2 + 1){
        // 上限.
        int uppper = (L / 2) - 1;
        
        // dif = D - Σ((10 の (L - 1 - j)乗 - 10 の j乗) * d[j]) の 計算.
        // ※ 解説上, N - *** と記載されているが, N を D に 読み替えている.
        ans += f(D, L, 0, uppper, 1LL);
    }
    
    // 5. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 3748
using System;
public class Hello{
    public static void Main()
    {
        // Your code here!
        int X = int.Parse(Console.ReadLine());
        if((X == 7 || X == 5)|| X == 3)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 11092
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd_int(void){
  int x;
  rd(x);
  return x;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
int main(){
  int N = rd_int() % 10;
  if(N==3){
    wt_L("bon");
    wt_L('\n');
    return 0;
  }
  if(N==0 || N==1 || N==6 || N==8){
    wt_L("pon");
    wt_L('\n');
    return 0;
  }
  wt_L("hon");
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// {
//   int N = rd_int() % 10;
//   if(N==3) wt("bon"), return 0;
//   if(N==0 || N==1 || N==6 || N==8) wt("pon"), return 0;
//   wt("hon");
// }


Measured memory_bytes: 3628
#!/usr/bin/env python3
h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for bi in range(1 << h):
    for bj in range(1 << w):
        d = [[""] * w for _ in range(h)]
        for i in range(h):
            for j in range(w):
                d[i][j] = c[i][j]
        for i in range(h):
            if ~bi >> i & 1:
                continue
            for j in range(w):
                d[i][j] = "r"
        for j in range(w):
            if ~bj >> j & 1:
                continue
            for i in range(h):
                d[i][j] = "r"
        s = 0
        for i in range(h):
            for j in range(w):
                if d[i][j] == "#":
                    s += 1
        if s == k:
            ans += 1
print(ans)


Measured memory_bytes: 9236
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int n;
    cin >> n;
    if (n >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int count = 0;
    for(int i = 0; i <= n/r; i++){
        for(int j = 0; j <= n/g; j++){
            if((n-(r*i+j*g))/b >= 0 && (n-(r*i+j*g))%b == 0){
//                cerr << i << " " << j << " " << (n-(r*i+j*g))/b << endl;
                count++;
            }
        }
    }

    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 888
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
AB = LIR(n)
AB.sort(key=itemgetter(1))
tmp = 0
for a, b in AB:
    if tmp + a <= b:
        tmp += a
    else:
        print("No")
        exit()
print("Yes")

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
vector<string>v;
set<pair<int, int>>S;
pair<int, int> simulate(int x, int y) {
	auto it = S.find(make_pair(x, y));
	if (it != S.end())return make_pair(-1, -1);
	else S.insert(make_pair(x, y));

	if (v[x][y] == '>')return simulate(x, y + 1);
	else if (v[x][y] == '<')return simulate(x, y - 1);
	else if (v[x][y] == '^')return simulate(x - 1, y);
	else if (v[x][y] == 'v')return simulate(x + 1, y);
	else return make_pair(x, y);
}
signed main() {
	int w, h;
	while (cin >> h >> w, h || w) {
		v = vector<string>(h);
		S.clear();
		rep(i, 0, h) cin >> v[i];

		auto p = simulate(0, 0);
		if (p == make_pair(-1, -1)) {
			cout << "LOOP" << endl;
		}
		else cout << p.second << " " << p.first << endl;
	}
	return 0;
}

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

int main(void)
{
    int A, B, C, D, Left, Right;

    cin >> A >> B >> C >> D;

    Left = A + B;
    Right = C + D;

    if (Left == Right)
    {
        cout << "Balanced" << endl;
    }
    else if (Left < Right)
    {
        cout << "Right" << endl;
    }
    else
    {
        cout << "Left" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

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


Measured memory_bytes: 2040
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[n],b[n-1];
    for(int i=0;i<n-1;i++){
        cin >> b[i];
    }
    b[n]=1000000000;
    for(int i=0;i<n-1;i++){
        a[0]=b[0];
        a[i+1]=min(b[i],b[i+1]);
        a[n-1]=b[n-2];
        
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=a[i];
        
    }
    
    cout << ans;
    
}


Measured memory_bytes: 256
x, y = map(int, input().split())
get=0
if x==1:
    get+=300000
if y==1:
    get+=300000
if x==2:
    get+=200000
if y==2:
    get+=200000
if x==3:
    get+=100000
if y==3:
    get+=100000
if x==1 and y==1:
    get+=400000
print(get)

Measured memory_bytes: 3064
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/

int main(void){
  string S;
  cin >> S;
  int flag[26];
  rep(i, S.length()){
    rep(j, 26){
      if (S[i] == alphabet_lower[j]) flag[j] = 1;
    }
  }
  rep(i, 26){
    if (flag[i] != 1) {
      cout << alphabet_lower[i] << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
from decimal import Decimal
import math

def walk(x, y, distance, angle, next_angle):
    radian = math.radians(angle)
    _x = Decimal(distance * math.cos(radian) + x)
    x = round(_x, 6)
    _y = Decimal(distance * math.sin(radian) + y)
    y = round(_y, 6)
    angle = angle - next_angle
    return x, y, angle
    
x = 0
y = 0
angle = 90
while True:
    input_line = raw_input()
    distance = int(input_line.split(',')[0])
    next_angle = int(input_line.split(',')[1])
    if distance == 0 and next_angle == 0: break
    x, y, angle = walk(x, y, distance, angle, next_angle)
print int(x)
print int(y)

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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;

int main() {
	FASTIO
	int n;
	cin >> n;
	vector<vector<int>> g(n + 1, vector<int>(n + 1));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> g[i][j];
		}
	}
	int woman = (1 << n);
	vector<vector<int>> dp(n + 1, vector<int>(woman));
	dp[0][0] = 1;
	constexpr ll MOD = 1e9 + 7;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < woman; j++) {
			if (i == __builtin_popcount(j)) {
				for (int k = 0; k < n; k++) {
					if (g[i][k + 1] && (j & (1 << k)))
						dp[i][j] = (dp[i][j] + dp[i - 1][j ^ (1 << k)]) % MOD;
				}
			}
		}
	}
	cout << dp[n][woman - 1] << endl;
}


Measured memory_bytes: 191668
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        int length = S.length();
        char[] data = S.toCharArray();
        int win = 0;
        for (int i = 0; i < length; i++) {
            if (data[i] == 'o') {
                win += 1;
            }
        }
        win += 15 - length;
        String answer = "NO";
        if (8 <= win) {
            answer = "YES";
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23252
N = int(input())
A = list(map(int, input().split()))

def SelectionSort(A):
    count = 0
    for i in range(N):
        min = i
        for j in range(i, N):
            if A[j] < A[min]:
                min = j
        if A[i] > A[min]:
            A[i], A[min] = A[min], A[i]
            count += 1
    print(' '.join(map(str, A)))
    print(count)

SelectionSort(A)


Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int D = sc.nextInt();
        int x = sc.nextInt();

        for (int i = 2001; i <= 2010; i++) {
            x = r * x - D;
            System.out.println(x);
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}

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

int main(){
    int a;
    cin >> a;
    vector <string> temp;
    vector <string>::iterator it;
    string zz;
    string prev;
    cin >> prev;
    int done = 0;
    temp.push_back(prev);
    for(int i=1; i<a; i++){
        cin >> zz;
        it = std::find(temp.begin(), temp.end(), zz);
        if( it != temp.end() || prev.back() != zz.front()){
            cout << "No";
            done = 1;
            break;
        }
        temp.push_back(zz);
        prev = zz;
    }
    if(!done)
        cout << "Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int count0 = 0;
  int count1 = 0;
  for (int i = 0; i < S.size(); i++){
    if (S.at(i) == '0'){
      count0++;
    }
    else {
      count1++;
    }
  }
  
  cout << S.size() - abs(count0-count1) << endl;
}
    
  
  

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

using namespace std;

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

using ll = long long;

int N,M;
int a[100010], b[100010];

int abs(int& a, int& b) {
  int c = a - b;
  return c < 0 ? -c : c;
}

int main() {
  int i;

  scanf("%d %d", &N, &M);
  REP(i,M) scanf("%d", &a[i]);

  sort(a, a + M);
  REP(i,M-1) b[i] = -abs(a[i], a[i+1]);
  sort(b, b + M - 1);

  ll res = 0;
  for (i = N-1; i < M-1; i++) res += -b[i];
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1024
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f=0,x=0,g,p=0,q=0,y=0,z=0;
double kk=0;
    vector<pair<long long,long long>>v;
    vector<long long>u;
    map<string,long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4,s5,s6;
   cin>>m>>n;
 l(i,n-m+1,n+m)
 {
     cout<<i<<" ";

 }
}






Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD_CONST 1000000007
typedef long long int lli;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans = min(n * a, b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            try
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                long n = long.Parse(Console.ReadLine());
                var arr = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

                if (arr.Contains(0))
                {
                    Console.WriteLine(0);
                }
                else
                {
                    checked {
                    long r = 1;
                    foreach (var i in arr)
                    {
                        r = r * i;
                        if (r > 1000000000000000000)
                        {
                            r = -1;
                            break;
                        }
                    }
                    Console.WriteLine(r.ToString());
                    }
                }

                Console.Out.Flush();
            }
            catch (Exception e)
            {
                Console.WriteLine(-1);
                Console.Out.Flush();
            }
        }
    }
}


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

using namespace std;

typedef long long ll;

#ifdef DEBUG
#define dbg(arg) (printf arg)
#define LOG cout << "line:" << __LINE__ << ":" << endl;
#else
#define dbg(arg)
#define LOG
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(15);
    string chs;
    cin >> chs;
    for (const auto &c : chs) {
        if (c == '1') cout << '9';
        else if (c == '9') cout << '1';
        else cout << c;
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#! /usr/bin/env perl

sub min{
    my ($f,$s,$t) = @_;
    $tmp = $f;
    if($tmp > $s){
        $tmp = $s; 
    }
    if($tmp > $t){
        $tmp = $t;
    }
    return $tmp;
}


sub max{
    my ($f,$s,$t) = @_;
    $tmp = $f;
    if($tmp < $s){
        $tmp = $s; 
    }
    if($tmp < $t){
        $tmp = $t;
    }
    return $tmp;
}

sub check{
    my ($f,$s,$t) = @_;
    $data_max = max($f,$s,$t);
    $data_min = min($f,$s,$t);

    if($s != $data_max && $s != $data_min){
        return 1;
    }
    else{
        return 0;
    }
}



my $in = <STDIN>;
chomp $in;

my $in_data = <STDIN>;
chomp $in_data;

@data = split / /, $in_data;
my $count = 0;

for $i(2 .. $in-1){
    $count += check($data[$i-2],$data[$i-1],$data[$i]);
} 
print $count."\n";

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
 
string sa,sb;
const int MN = 2010;
int a[MN],b[MN];
int N;
 
int needl[MN],needr[MN];
 
int calc(int L,int R,int i){
	chmax(L,i);
	int res = R*2 + L + (L-i);
	return res;
}
 
int solve(){
	rep(i,N){
		for(int t=0;;t++){
			int j = (i-t+N)%N;
			if(b[j]){
				needl[i] = t;
				break;
			}
		}
	}
	rep(i,N){
		for(int t=0;;t++){
			int j = (i+t)%N;
			if(b[j]){
				needr[i] = t;
				break;
			}
		}
	}
	int res = 1e9;
	rep(i,N){
		vector<int> difs;
		rep(x,N){
			if(a[(i+x)%N]!=b[x]) difs.pb((i+x)%N);
		}
		using P = pair<int,int>;
		vector<P> vp;
		for(int d:difs){
			if(needl[d]<=i) continue;
			vp.pb(P(needl[d],needr[d]));
		}
		sort(all(vp),greater<P>());
 
		int tmp = 1e9;
		int L = N-1, R = 0;
 
		for(P p:vp){
			L = p.fs;
			chmin(tmp,calc(L,R,i));
			chmax(R,p.sc);
		}
		L = 0;
		chmin(tmp,calc(L,R,i));
 
		if(vp.empty()) tmp = i;
 
		tmp += difs.size();
 
		chmin(res,tmp);
	}
	return res;
}
 
int main(){
	cin>>sa>>sb;
	N = sa.size();
	rep(i,N){
		a[i] = sa[i]=='1';
		b[i] = sb[i]=='1';
	}
	if(sb == string(N,'0')){
		if(sa == string(N,'0')) puts("0");
		else puts("-1");
		return 0;
	}
	int ans = 1e9;
	rep(tt,2){
		chmin(ans,solve());
		reverse(a,a+N);
		reverse(b,b+N);
	}
	cout<<ans<<endl;
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	string s;
	cin >> s;
	map<char, int> mp;
	bool ok = true;
	rep(i, s.size()) {
		if (mp[s[i]] != 0) ok = false;
		mp[s[i]]++;
	}
	if (ok) {
		cout << "yes" << endl;
	} else {
		cout << "no" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
<?php

class Simulator
{
    public $line = array();
    public $n_operations;
    public $quantum;
    public $dll2;


    public function __construct()
    {
        fscanf(STDIN, '%d', $this->n_operations);
        $dll = new \SplDoublyLinkedList();
        for ($i = 0; $i < $this->n_operations; $i++) {
            $line = trim(fgets(STDIN));
            if ($line[0] === 'i') {
                $dll->unshift(substr($line, 7));
            } elseif ($line[6] === 'F') {
                $dll->shift();
            } elseif ($line[6] === 'L') {
                $dll->pop();
            } else {
                $check = substr($line, 7);
                foreach ($dll as $key => $val) {
                    if ($val === $check) {
                        $dll->offsetUnset($key);
                        break;
                    }
                }
            }
        }
        $this->dll2 = $dll;
    }

    // public function doOperation()
    // {
    //     $dll = new \SplDoublyLinkedList();
    //     for ($i = 0; $i < $this->n_operations; $i++) {
    //         $line2 = $this->line[$i];
    //         if ($line2[0] === 'i') {
    //             $dll->unshift(substr($line2, 7));
    //         } elseif ($line2[6] === 'F') {
    //             $dll->shift();
    //         } elseif ($line2[6] === 'L') {
    //             $dll->pop();
    //         } else {
    //             $check = substr($line2, 7);
    //             foreach ($dll as $key => $val) {
    //                 if ($val === $check) {
    //                     $dll->offsetUnset($key);
    //                     break;
    //                 }
    //             }
    //         }
    //     }
    //     $this->dll2 = $dll;
    // }

    public function getAnswer()
    {
        $str = array();
        $dll = $this->dll2;
        while (true) {
            try {
                $val = $dll->shift();
                $str[] = $val;
            } catch (Exception $e) {
                echo implode(' ', $str), PHP_EOL;
                break;
            }
        }
    }
}

$answer = new Simulator();
// $answer->doOperation();
$answer->getAnswer();



Measured memory_bytes: 136148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int ans[n+1];
  rep(i,0,n+1) ans[i]=0;
  rep(x,1,101){
    rep(y,1,101){
      rep(z,1,101){
        if(x*x+y*y+z*z+x*y+y*z+z*x<=n){
          ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
        }
      }
    }
  }
  rep(i,1,n+1){
    cout<<ans[i]<<endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s;cin >> s;
	int x=0,ans=0;
	rep(i,n){
		if(s.at(i)=='I') x++;
		else{
			ans=max(ans,x);
			x--;
		}
	}
	ans=max(ans,x);
	cout << ans << endl;
}

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

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var lastDictionary = new Dictionary<int, int>();

            var days = int.Parse(Console.ReadLine());

            var scoreDownCoefficients = Console.ReadLine().Split(" ")
                .Select((x, i) => (score: int.Parse(x), questionNumber: i + 1))
                .OrderByDescending(x => x.score)
                .ToDictionary(x => x.questionNumber, x => x.score);

            foreach (var today in Enumerable.Range(1, days))
            {
                var scoreUpNumber = Console.ReadLine().Split(" ")
                    .Select((score, i) => (score: int.Parse(score), questionNumber: i + 1))
                    .OrderByDescending(x =>
                    {
                        lastDictionary.TryGetValue(x.questionNumber, out var lastHeld);

                        return x.score - (today - lastHeld) * scoreDownCoefficients[x.questionNumber];
                    })
                    .First();

                lastDictionary[scoreUpNumber.questionNumber] = today;

                Console.WriteLine(scoreUpNumber.questionNumber);
            }
        }
    }
}


Measured memory_bytes: 29160
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	string S;
	cin >> S;
	ll counter = 0;
	rep(i, S.size()) {
		if (S[i] != S[S.size() - 1 - i]) counter++;
	}
	counter /= 2;
	cout << counter << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

template<typename T> //最大公約数
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T> //最小公倍数
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

vector<vector<int> > graph;
vector<int> visited;
bool exist = false;

void dfs(int st){
    queue<int> que;
    que.push(st);
    visited[st] = true;
    while (que.size()){
        int now = que.front();
        visited[now] = true;
        que.pop();
        for (int i = 0; i < graph[now].size(); i++){
            int to = graph[now][i];
            if (to == st){
                exist = true;
            }
            if (!visited[to]){
                que.push(to);
            }
        }
    }
}

int main(){
    int V, E; cin >> V >> E;
    graph.resize(V); visited.assign(V, 0);
    for (int i = 0; i < E; i++){
        int s, t; cin >> s >> t;
        graph[s].push_back(t);
    }
    for (int i = 0; i < V; i++){
        visited.assign(V, 0);
        dfs(i);
        if (exist){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}




Measured memory_bytes: 3196
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int main()
{
	long long n,m;
	long long ans;
	while(~scanf("%lld %lld",&n,&m))
	{
		if(n >= 2&&m >= 2) ans = (n-2)*(m-2);
		else if(n == 1&&m != 1) ans = m-2;
		else if(m == 1&&n != 1) ans = n-2;
		else if(n == 1&&m == 1) ans = 1;
		printf("%lld\n",ans);
	}
	return 0;
}

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b<c+d)
    cout << "Right" << endl;
    else if(a+b>c+d)
    cout << "Left" << endl;
    else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256