akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  
  bool jud = true;
  
  for (int i=1; i<=1e9; i++){
    if (abs(a-i) == abs(b-i)) {
      cout << i << endl;
      jud = false;
      break;
    }
  }
  
  if (jud) cout << "IMPOSSIBLE" << endl;
  
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <fstream>

using namespace std;

int main()
{
    int n;
    cin >> n ;
    int temp;
    int largest = 0;
    int Count = 0;
    int A[100005] = {0};
    for (int i=0;i<n;i++){
        cin >> temp;
        largest=max(largest,temp);
        A[temp]=1;
    }
    for (int i=0;i<largest+1;i++)
        if (A[i])
            Count++;

    if (Count%2==0)
        Count--;
    cout << Count;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    int x[5];
    rep(i, 5)
    {
        cin >> x[i];
        if(x[i]==0)
        {
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> p(n,0);
	for(int i=0;i<n;i++)
	{
		cin >> p.at(i);
	}
	int k =0;
	for(int i=0;i<n-2;i++)
	{
		int q=p.at(i),r=p.at(i+1),s=p.at(i+2);
		if(r!=max({q,r,s})&&r!=min({q,r,s}))
		{
			k++;
		}
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const long long N = 1e5 + 5;
using namespace std;

typedef pair <long long, long long> ii;
vector <ii> adj[N];
vector <long long> mv;
long long n, a, b, c, ans, res = 1e9, d[N];
bool check[N];

void dfs(long long u, long long p){
    d[u] = 1;
    for (long long i = 0; i < adj[u].size(); i++){
        long long v = adj[u][i].first;
        if (v == p) continue;
        dfs(v, u);
        d[u] += d[v];
    }
    for (long long i = 0; i < adj[u].size(); i++){
        long long v = adj[u][i].first;
        if (v == p) continue;
        if (d[v]*2 > n) return;
    }
    if (d[u]*2 >= n) {
        mv.push_back(u);
        check[u] = 1;
    }
    return ;
}

void redfs(long long u, long long p){
    for (long long i = 0; i < adj[u].size(); i++){
        long long v = adj[u][i].first, cost = adj[u][i].second;
        if (v == p) continue;
        d[v] = d[u] + cost;
        redfs(v, u);
    }
}
int main(){
    cin >> n;
    for (long long i = 1; i < n; i++) {
        cin >> a >> b >> c;
        adj[a].push_back(ii(b, c));
        adj[b].push_back(ii(a, c));
    }
    dfs(1, 0);
    long long centroid = mv[0];
    for (long long i = 0; i < adj[centroid].size(); i++){
        long long v = adj[centroid][i].first, cost = adj[centroid][i].second;
        if (check[v]){
            res = cost;
            break;
        }
        else{
            res = min(res, cost);
        }
    }
    res = -res;
    d[centroid] = 0;
    redfs(centroid, centroid);
    for (long long i = 1; i <= n; i++){
        res += 2*d[i];
    }
    cout << res;
}


Measured memory_bytes: 12672
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
    int a,b,c;
    double PI=acos(-1);
    double rad,s,d,l,h;
    cin>>a>>b>>c;
    rad=c*PI/180;
    s=a*b*sin(rad)/2;
    cout<<fixed<<setprecision(15)<<s<<endl;
    d=a*a+b*b-2*a*b*cos(rad);
    l=a+b+sqrt(d);
    cout<<fixed<<setprecision(15)<<l<<endl;
    h=b*sin(rad);
    cout<<fixed<<setprecision(15)<<h<<endl;
    
    return 0;
}


Measured memory_bytes: 3500
#include <iostream>
#include<algorithm>
using namespace std;
int a[102],n;
int main()
{  
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    sort(a,a+n);
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==a[i-1]) continue;
        else cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

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

string getString(string s, int n){
    string returnString = "";
    for(int i=0; i<n; i++){
        returnString += s;
    }
    return returnString;
}

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string answer = "";
    int delY = ty - sy;
    int delX = tx - sx;

    // s -> tの行き方 #1
    // 上に(ty-sy)回、右に(tx-sx)回
    answer += getString("U", delY);
    answer += getString("R", delX);

    // t -> sの行き方 #2
    // 下に(ty-sy)回、左に(tx-sx)回
    answer += getString("D", delY);
    answer += getString("L", delX);

    // s -> tの行き方 #3
    // 左に1回、上に(ty-sy+1)回、右に(tx-sx+1)回、下に1回
    answer += "L" + getString("U", delY + 1);
    answer += getString("R", delX + 1) + "D";

    // t -> sの行き方 #4
    // 右に1回、下に(ty-sy+1)回、左に(tx-sx+1)回、上に1回
    answer += "R" + getString("D", delY + 1);
    answer += getString("L", delX + 1) + "U";

    cout << answer << endl;
    return 0;
}

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

int main(){
  int n,k; cin>>n>>k;
  int h[n];
  int count=0;
  for(int i=0;i<n;i++){
    cin>>h[i];
    if(h[i]>=k) count++;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 640
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n // 2)
    quit()

v1 = v[::2]
even = sorted(Counter(v1).items(), key=lambda x: x[1], reverse=True)[0:2]

v2 = v[1::2]
odd = sorted(Counter(v2).items(), key=lambda x: x[1], reverse=True)[0:2]

if even[0][0] == odd[0][0]:
    mode = max(even[0][1] + odd[1][1], even[1][1] + odd[0][1])


else:
    mode = even[0][1]
    mode += odd[0][1]
ans = n - mode
print(ans)


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

typedef long long ll;

const ll MOD=1e9+7;

int main() {
    string s; cin >> s;
    int n=s.size();
    vector<vector<ll>> dp(n+1, vector<ll>(4, 0));
    dp[0][0]=1;
    for (int i=1; i<=n; ++i) {
        char c=s[i-1];
        dp[i][0]=dp[i-1][0];
        dp[i][1]=dp[i-1][1];
        dp[i][2]=dp[i-1][2];
        dp[i][3]=dp[i-1][3];
        if (c=='A') {
            dp[i][1]+=dp[i-1][0];
        } else if (c=='B') {
            dp[i][2]+=dp[i-1][1];
        } else if (c=='C') {
            dp[i][3]+=dp[i-1][2];
        } else {
            dp[i][0]+=dp[i-1][0]*2;
            dp[i][1]+=dp[i-1][0]+dp[i-1][1]*2;
            dp[i][2]+=dp[i-1][1]+dp[i-1][2]*2;
            dp[i][3]+=dp[i-1][2]+dp[i-1][3]*2;
        }
        for (int k=0; k<4; ++k) {
            dp[i][k]%=MOD;
        }
    }
    cout << dp[n][3];
    return 0;
}

Measured memory_bytes: 7424
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P, X = [], []
for _ in range(M):
    p, x = map(int, input().split())
    P.append(p)
    X.append(x)

t_sum = sum(T)

for i in range(M):
    print(t_sum - T[P[i]-1] + X[i])

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

int main()
{
    int n,k;
    string s;
    cin>>n>>k;
    cin>>s;
    for(int i=0;i<n;i++)
    {
        if(i+1==k)
        {
            if(s[i]=='A')
            {

                cout<<'a';
            }
            else if(s[i] == 'B')
            {

                cout<<'b';
            }
            else
            {

                cout<<'c';
            }

        }
        else
        {

            cout<<s[i];
        }

    }


}


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

int main() {
    string s;
    int count[26] = {};
    bool yes = true;
    cin >> s;
    int a;
    for (int i = 0; i < s.size(); i++) {
        a = s[i]-97;
        count[a]++;
    }
    for (int i = 0; i < s.size(); i++) {
        if (count[i] != 0 && count[i] != 1) yes = false;
    }
    if (yes) cout << "yes" << endl;
    else cout << "no" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int MIN=9999;
string S;
long long int MOD = 1000000007;
const int MAX = 1000001;
long long int fac[MAX],finv[MAX], inv[MAX];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<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)return 0;
    if(n < 0 || k< 0)return 0;
    return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
}

int main(){
    long long int N,K,p[200001],sum[200002],ksum[200002];
    double a,b,x;
    cin >> a >> b >> x;
    if(2*x/(a*a) - b >= 0)
        printf("%.16lf\n",90-(atan2((a*a*a),2*a*a*b-2*x)/M_PI*180));
    else{
        printf("%.16lf\n",90-atan2(2*x,a*b*b)/M_PI*180);
    }
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll a, b;
    cin >> a >> b;

    if((a*b)%2 == 0){
        cout << "Even" << endl;
    }
    else{
        cout << "Odd" << endl;
    }
    return 0;
}

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

int main(){
    int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;
    vector<int> sugar, water;
    for(int i = 0; c*i <= f; ++i){
        for(int j = 0; c*i + d*j <= f; ++j){
            sugar.push_back(c*i + d*j);
        }
    }
    for(int i = 0; 100*a*i <= f; ++i){
        for(int j = 0; 100*(a*i + b*j) <= f; ++j){
            water.push_back(a*i + b*j);
        }
    }
    int last_water = 100*a, last_sugar = 0;
    rep(i, water.size()){
        rep(j, sugar.size()){
            if((100*water[i] + sugar[j] <= f) && (sugar[j] <= water[i]*e)){
                if(last_sugar*(100*water[i]+sugar[j]) < sugar[j]*(last_sugar+last_water)){
                    last_water = 100*water[i];
                    last_sugar = sugar[j];
                } 
            }
        }
    }
    cout << last_water+last_sugar << " " << last_sugar;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9+5


int main(){
    int n,k;
    cin>>n>>k;
    vector<int> hights(n+1,0);
    for(int i=1;i<=n;i++){
        cin>>hights[i];
    }
    vector<int> dp(n+1,INF);
    dp[1] = 0;
    
    for(int i=2;i<=n;i++){
        for(int j=i-1;j>=max(1,i-k);j--)
        {
            dp[i] = min(dp[i],dp[j] + abs(hights[i]-hights[j]));
        }
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2;
    int a[100007],b[100007],a1,b1,c1,d1,q,x,y;
    cin>>s1>>s2;
    a[0]=0;b[0]=0;
    for(int i=1;i<=s1.size();++i)
        if(s1[i-1]=='A')a[i]=a[i-1]+1;
        else a[i]=a[i-1]+2;
    for(int i=1;i<=s2.size();++i)
        if(s2[i-1]=='A')b[i]=b[i-1]+1;
        else b[i]=b[i-1]+2;
    cin>>q;
    while(q--)
    {
        cin>>a1>>b1>>c1>>d1;
        x=(a[b1]-a[a1-1])%3;
        y=(b[d1]-b[c1-1])%3;
        if(x==y)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  map<string, int> r;
  r["SUN"] = 0;
  r["MON"] = 1;
  r["TUE"] = 2;
  r["WED"] = 3;
  r["THU"] = 4;
  r["FRI"] = 5;
  r["SAT"] = 6;
  string s;
  cin >> s;
  cout << 7-r[s] << endl;
  return 0;
}

Measured memory_bytes: 256
#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[i];
    }

    sort(a.begin(), a.end());
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int b = a[i];
        int c = upper_bound(a.begin(), a.end(), b) - lower_bound(a.begin(), a.end(), b);
      if(b > c)
        {
            ans += c;
        }
        else if(b < c)
        {
            ans += c-b;
        }
        i += c-1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <queue>
using namespace std;

int main() {
    priority_queue<int> que;
    while(1){
        string s;
        cin >> s;
        if(s == "insert"){
            int x;
            cin >> x;
            que.push(x);
        }
        else if(s == "extract"){
            cout << que.top() << endl;
            que.pop();
        }
        else{
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 7028
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
  
  string S,T;
  cin >> S >> T;

  int l = S.size();
  bool judge = false;

  for(int i=0;i<l;i++){
    bool check = true;
    for(int j=0;j<l;j++){
      if( S[(i+j)%l]!= T[j] ) check = false;
    }
    if(check){
      judge = true;
      break;
    }
  }

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

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

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((100*a + 10*b + c)%4 == 0 ? "YES" : "NO") << endl;
}

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

int main() {
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if(a*c <= b) cout << c << endl;
  else cout << b/a << endl;
  
  
  
}


Measured memory_bytes: 256
number = input()

number_list = number.split(' ')

a = int(number_list[0])
b = int(number_list[1])

if -1000 <= a and a <= 1000:
    if -1000 <= b and b <= 1000:
        if a < b:
            print("a < b")
        elif a > b:
            print("a > b")
        elif a == b:
            print("a == b")



Measured memory_bytes: 5592
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

// ll:9187201950435737471 int:2139062143
#define setinf(x) memset((x), 127, sizeof(x))
#define MAX_V 10000

class edge {
public:
  int from, to, cost;
  edge(int from = 0, int to = 0, int cost = 0): from(from), to(to), cost(cost) {}
  bool operator < (const edge &e) const {
    return cost > e.cost;
  }
};

bool comp(const edge &e1, const edge &e2) {
  return e1.cost < e2.cost;
}

int V, E;
vector <edge> graph[MAX_V];

int solve() {
  int mincost[V];
  bool used[V];
  memset(used, false, sizeof(used));
  setinf(mincost);
  mincost[0] = 0;
  int ret = 0;

  priority_queue<edge> pque;
  for (int i = 0; i < graph[0].size(); i++) {
    pque.push(graph[0][i]);
  }
  used[0] = true;
  while (true) {
    while (!pque.empty() && used[pque.top().to]) pque.pop();
    if (pque.empty()) break;

    int p = pque.top().to;
    used[p] = true;
    ret += pque.top().cost;
    pque.pop();
    for (int i = 0; i < graph[p].size(); i++) {
      edge e = graph[p][i];
      if (used[e.to]) continue;
      pque.push(e);
    }
  }

  return ret;
}

int main() {
  cin >> V >> E;
  for (int i = 0; i < E; i++) {
    int s, t, w;
    cin >> s >> t >> w;
    graph[s].push_back(edge(s, t, w));
    graph[t].push_back(edge(t, s, w));
  }
  cout << solve() << endl;
}

Measured memory_bytes: 6952
#include <bits/stdc++.h>
 
using namespace std;
 
const long long inf = (long long) 1e18;
 
const int N = 5010;
 
long long f[N][N];
 bool cmp(pair<int,int> a,pair<int,int> b){
return a.first < b.first;
}
int main() {
  int n;
  scanf("%d", &n);
  vector< pair<int,int> > a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    a[i].first += a[i].second;
  }
  sort(a.begin(), a.end(),cmp);
  for (int i = 0; i < n; i++) {
    a[i].first -= a[i].second;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      f[i][j] = inf;
    }
  }
  f[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      long long ft = f[i][j];
      if (ft == inf) {
        continue;
      }
      f[i + 1][j] = min(f[i + 1][j], ft);
      if (ft <= a[i].first) {
        f[i + 1][j + 1] = min(f[i + 1][j + 1], ft + a[i].second);
      }
    }
  }
  int ans = 0;
  for (int j = 0; j <= n; j++) {
    if (f[n][j] != inf) {
      ans = j;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 194176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  
  vector<string> a(H);
  
  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }
  
  for (int i = 0; i < W+2; i++) {
    cout << '#';
  }
  cout << endl;

  for (int i = 0; i < H; i++) {
    cout << '#' + a.at(i) +'#' << endl;
  }

  for (int i = 0; i < W+2; i++) {
    cout << '#';
  }
  cout << endl;
}

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

int main(){
	int N; cin >> N;
	ll ans = 1;
	int A[N];
	for(int i=0; i<N; i++) cin >> A[i];
	int a[3] = {0, 0, 0};
	for(int i=0; i<N; i++){
		int cnt = 0;
		if(i==0 && A[i] != 0){
			cout << 0 << endl;
			return 0;
		}
		for(int j=0; j<3; j++){
			if(a[j] == A[i]){
				cnt++;
			}
		}
		if(cnt == 0){
			cout << 0 << endl;
			return 0;
		}
		ans = ans * cnt % mod;
		for(int j=0; j<3; j++){
			if(a[j] == A[i]){
				a[j]++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok ? "Yes" : "No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n + 1);
  vector<ll> b(n + 1);
  ll ans = 0;
  rep(i, n + 1)
  {
    cin >> a[i];
  }
  rep(i, n) cin >> b[i];
  b[n] = 0;
  rep(i, n + 1)
  {
    ans += min(b[i], a[i]);
    if (i != n)
    {
      ll suplus = b[i] - a[i];
      if (suplus>0) {
        ans += min(a[i+1], suplus);
        a[i+1] = max(0LL, a[i+1]-suplus);
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 1792
N,M = map(int,input().split())

A = list(map(int,input().split()))
A.sort()
A.reverse()
val = sum(A)/(4*M)

flag = False
for count in range(M):
    if A[count] >= val:
        flag = True
    else:
        flag = False
        break;

if flag == True:
    print("Yes")
else:
    print("No")

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

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

Measured memory_bytes: 3200
using System;
using System.Collections.Generic;
using System.Text;

namespace test
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			List<int> resultList = new List<int> ();
			string input;
			while ((input = Console.ReadLine()) != "0 0") {
				string[] inputArray = input.Split (' ');
				int n = int.Parse (inputArray [0]);
				int s = int.Parse (inputArray [1]);

				int count = Search (s, 0, 0, n, 0);

				resultList.Add (count);
			}

			foreach(int r in resultList){
				Console.WriteLine(r);
			}


		}

		static int Search(int s,int a,int count,int n,int currentSum)
		{
			for (int i=a; i<=9; i++) {
				if (n == 1) {
					if (s == currentSum + i) {
						count++;
						break;
					}
				} else {
					count = Search (s, i+1, count, n - 1, currentSum + i);
				}
			}

			return count;
		}
	}
	
}

Measured memory_bytes: 5664
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
	double r;
	double a, b;
	cin >> r;
	a = M_PI * r * r;
	b = 2 * M_PI * r;
	printf( "%.6f %.6f", a, b );
	return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    int sum = accumulate(A.begin(), A.end(), 0);
    int ans = 1;
    auto solve = [&](int n) {
        vector<int> B;
        for(auto &a : A) if(a % n) B.push_back(a % n);
        sort(B.begin(), B.end());
        int64 suml = 0, sumr = 0;
        for(auto &b : B) sumr += n - b;
        if(max(suml, sumr) <= K && (sumr - suml) % n == 0) return n;
        for(auto &b : B) {
            suml += b;
            sumr -= n - b;
            if(max(suml, sumr) <= K && (sumr - suml) % n == 0) return n;
        }
        return 1;
    };
    for(int i = 1; i * i <= sum + 2; ++i) {
        if(sum % i == 0) {
            ans = max(ans, solve(i));
            ans = max(ans, solve(sum / i));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int n;
lli arr[200007];
void TestingChaluKarEyy(){
	lli k;
	cin>>n>>k;
	fr(i,1,n) cin>>arr[i];
	lli start=1,end=1000000000;
	lli mid;
	lli ans=10000000000;
	while(start<=end) {
		mid=(start+end)/2;
		// cout<<start<<" "<<end<<" : "<<mid<<"\n";
		lli cnt=0;
		fr(i,1,n) {
			cnt+=(ceil((long double)arr[i]/mid)-1);
		}
		if(cnt>k) start=mid+1;
		else {
			ans=min(ans,mid);
			end=mid-1;
		}
		
	}
	cout<<ans<<"\n";
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	jaldiKarNe;
	int TestingKaravvuChhe=1;
	// cin>>TestingKaravvuChhe;
	while(TestingKaravvuChhe--){
		TestingChaluKarEyy();
	}
}


Measured memory_bytes: 5168
n,q = map(int,input().split())
s = input()
dp = [0]*(n+1)
ans = []
for i in range(n):
    dp[i+1] = dp[i]+(1 if s[i:i+2]=='AC' else 0)
for i in range(q):
    l,r = map(int,input().split())
    ans.append(dp[r-1]-dp[l-1])
[print(i) for i in ans]

Measured memory_bytes: 12704
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5010;

int main() {
    ll n;
    string s;
    cin >> n >> s;

    vvl dp(MAX_N, vl(MAX_N));  // dp[i][j] : s[i]とs[j]から始めたときに一致する長さの最大値
    for(ll i = n-1; i >= 0; i--) {
        for(ll j = n-1; j >= 0; j--) {
            if(s[i] == s[j]) {
                dp[i][j] = dp[i+1][j+1] + 1;
            }
        }
    }
    
    ll ans = 0;
    rep(i, n-1) {
        exrep(j, i+1, n) {
            ll now = min(dp[i][j], j-i);
            ans = max(ans, now);
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 196608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
bool clear = false;
int H, W;
string S[13];

void check(vector<string> now) {
    /*
    cerr << "CHECK" << endl;
    for(int i = 0; i < now.size(); i++) cerr << now[i] << endl;
    */
    vector<string> rev(W);
    for(int h = 0; h < W; h++) {
        rev[h] = now[h];
        reverse(rev[h].begin(), rev[h].end());
    }
    bool used[15];
    for(int h = 0; h < W; h++) used[h] = false;
    bool mirror = false;
    for(int h = 0; h < W; h++) {
        if(used[h]) continue;
        for(int nowh = h + 1; nowh < W; nowh++) {
            if(now[h] == rev[nowh]) {
                used[h] = true;
                used[nowh] = true;
                break;
            }
        }
        if(used[h]) continue;
        if(W % 2 == 0 || mirror) return;
        if(rev[h] != now[h]) return;
        mirror = true;
        used[h] = true;
    }
    clear = true;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    for(int h = 0; h < H; h++) cin >> S[h];
    vector<int> v(H);
    for(int h = 0; h < H / 2; h++) v[h] = 1;
    sort(v.begin(), v.end());
    do {
        if(clear) break;
        vector<string> T;
        for(int i = 0; i < H; i++) {
            if(v[i]) T.push_back(S[i]);
        }
        vector<int> indices;
        for(int i = 0; i < H; i++) {
            if(v[i] == 0) indices.push_back(i);
        }
        sort(indices.begin(), indices.end());
        do {
            vector<string> now = T;
            for(int i = 0; i < indices.size(); i++) {
                now.push_back(S[indices[i]]);
            }
            vector<string> sub = now;
            bool unloop = false;
            for(int h = 0; h < H; h++) sort(sub[h].begin(), sub[h].end());
            //cerr << T.size() << " " << now.size() << " " << sub.size() << endl;
            //for(int h = 0; h < H; h++) cerr << sub[h] << endl;
            for(int h = 0; h * 2 < H; h++) {
                if(sub[h] != sub[H-1-h]) unloop = true;
            }
            if(unloop) continue;
            //cerr << "passed" << endl;
            vector<string> query(W);
            for(int h = 0; h < H; h++) {
                for(int w = 0; w < W; w++) {
                    query[w].push_back(now[h][w]);
                }
            }
            check(query);
        } while(next_permutation(indices.begin(), indices.end()));
    } while(next_permutation(v.begin(), v.end()));
    if(clear) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

template<typename T>
void p(T elem) {cout << elem << endl;}
template<typename T>
void ps(vector<T>& arr) { for(T e: arr) p(e); }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int vs, es;
    cin >> vs >> es;
    int vs3 = vs*3;
    vector<vector<int>> mat(vs3);
    for(int i = 0; i < es; i++) {
        int src, dst;
        cin >> src >> dst;
        // 0-indexed
        src--; dst--;
        // v1*3 -> v2*3+1
        for(int j = 0; j < 3; j++) {
            int nj = (j+1)%3;
            mat[src*3+j].push_back(dst*3+nj);
        }
    }
    int start, goal;
    cin >> start >> goal;
    start--; goal--;
    debug("start: %d goal: %d\n", start, goal);

    // bfs
    // <int,int> = (v, cnt)
    queue<pii> queue;
    vector<char> checked(vs3);
    checked[start*3] = 1;
    queue.push(make_pair(start*3, 0));
    int ans = -1;
    while(!queue.empty()) {
        pii p = queue.front(); queue.pop();
        if(p.first == goal*3) {
            ans = p.second/3;
            break;
        }
        for(int elem: mat[p.first]) {
            if(checked[elem]) continue;
            checked[elem] = 1;
            queue.push(make_pair(elem, p.second+1));
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 19820
#include<stdio.h>

int main(void){
 int c=0;
 int w=3;
 char s[2][3];
 scanf("%s",s[0]);
 scanf("%s",s[1]);
 while(w){
  w--;
  if(s[0][w]==s[1][2-w]){
   c++;
  }
 }
 if(c==3){
  printf("YES\n");
 }else{
  printf("NO\n");
 }
 return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define in(n, m) for (int i=n; i<m;i++)
#define inj(n, m)for (int j=n; j<m;j++)
#define ink(n, m)for (ll k=n; k<m;k++)
using namespace std;
using ll=long long;
using P =pair<ll, ll>;
const ll INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int main() {
	string s;
	string t;
	cin >> s;
	cin >> t;
	
	if (s.size() + 1 == t.size()) {
		t.pop_back();
		if (s == t) { cout << "Yes" << endl; }
		else cout << "No" << endl;
	}
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3032
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
MAX = 60

acc = [0] * MAX
ans = [0] * MAX

num = a[0]
for i in range(MAX):
    if num & 1:
        acc[i] = 1
    num >>= 1

for i, e in enumerate(a[1:], 1):
    for j in range(MAX):
        if e & 1:
            ans[j] += i - acc[j]
            acc[j] += 1
        else:
            ans[j] += acc[j]

        e >>= 1

ans_num = 0
for i, e in enumerate(ans):
    ans_num += pow(2, i, mod) * e
    ans_num %= mod

print(ans_num)


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

using namespace std;

typedef long long ll;

int main(){
  ll X,K,D;
  ll ans;
  cin >> X >> K >> D;
  if(X < 0) X *= -1;
  if(X/K >= D) ans = X - K * D;
  ll a = X / D;
  if(X/K < D){
    if((K-a)%2==0) ans = X - D * a;
    else ans = D*(a+1) - X;
  }
  cout << ans << endl;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

typedef pair<char, char> P;


int main() {
    int n;
    cin >> n;
    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];
    vector<ll> numbers2 = numbers;
    sort(numbers2.begin(), numbers2.end());


    int e_o = 0, o_e = 0;
    for (int i = 0; i < n; i++) {
        int k = numbers[i];
        auto it = lower_bound(numbers2.begin(), numbers2.end(), k);
        int index = distance(numbers2.begin(), it);
        if (index % 2 == 0) {
            if (i % 2 == 0) continue;
            e_o++;
        } else {
            if (i % 2 == 1) continue;
            o_e++;
        }
    }

    assert(e_o == o_e);

    cout << e_o << endl;


}



Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int N,i;
  int *A;

  scanf("%d",&N );
  A = calloc(N, sizeof(int));

  for(i=0; i<N; i++)
    scanf("%d",&A[i]);

  for(i=0; i<N; i++){
    if(A[i]%2 != 0)
      continue;
    else if(A[i]%3 == 0 || A[i]%5 == 0)
      continue;
    else{
      printf("DENIED");
      return 0;
    }
  }
  printf("APPROVED");

  free(A);

  return 0;
}


Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string o,e;
  cin >> o >> e;
  for(ll i=0;i<o.size()+e.size();i++) {
    if(i%2) cout << e[i/2];
    else cout << o[i/2];
  }
  cout << endl;
}

Measured memory_bytes: 256
($x, $y) = split(/ /, <>);

$r = 2018;
for $i ($x .. $y - 1){
	for $n ($x + 1 .. $y){
		$mod = ($i * $n) % 2019;
		if($mod == 0){
			$r = 0;
			last;
		}
		$r = $mod if($mod < $r);
	}
	last if($r == 0);
}

print "$r\n";


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner cin = new Scanner(System.in);
		int Target = cin.nextInt();
		int result = 1;
		String temp = "equal";
		long list[] = new long[Target];

		for(int i = 0; i < Target; i++){
			list[i] = cin.nextLong();
		}

		for(int j=0; j< Target-1;j++){
			if("equal".equals(temp)){
				if(list[j]<list[j+1]){
					temp = "asc";
					continue;
				}else if(list[j]>list[j+1]){
					temp = "desc";
					continue;
				}
			}
			if("asc".equals(temp)){
				if(list[j]<=list[j+1]){
				}else{
					result += 1;
					temp = "equal";
				}
			}
			if("desc".equals(temp)){
				if(list[j]>=list[j+1]){
				}else{
					result+=1;
					temp="equal";
				}
			}

		}
		System.out.println(result);

	}
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n == 1)
    {
        cout << setprecision(16) << 1.0000000000 << endl;
    }
    else if (n % 2 == 0)
    {
        cout << setprecision(16) << 0.5000000000 << endl;
    }
    else
    {
        double ans = (((double)n + 1.0) / 2) / n;
        cout << setprecision(16) << ans << endl;
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int K;
  cin >> K;
  vector<int> A(K);
  rep(i, K) cin >> A[i];

  reverse(all(A));

  ll L = 2;
  ll R = 2;

  rep(i, K) {
    L = ceil((double)(L) / A[i]) * A[i];
    R = floor((double)(R) / A[i]) * A[i] + A[i] - 1;
    if (L > R) {
      cout << "-1" << endl;
      return 0;
    }
  }

  cout << L << ' ' << R << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    string s;
    cin>>s;
    int n=s.size();
    rep(i,0,n-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
    }
    rep(i,0,n-2){
        if(s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<-1<<" "<<-1<<endl;
    return 0;
}




Measured memory_bytes: 512
S=input()
data=[]
X=''
cnt=0
for s in S:
    if s=='x':
        cnt+=1
    else:
        data.append(cnt)
        cnt=0
        X+=s
data.append(cnt)
ans=0
for i in range(len(data)//2):
    ans+=abs(data[i]-data[-1*i-1])
flag=True
for i in range(len(X)//2):
    if X[i]!=X[-1*i-1]:
        flag=False
if flag:print(ans)
else:print(-1)

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<ll, ll>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;
const ll INF = 1E+18;

int main()
{
  string s;
  cin >> s;
  map<char, int> mp;
  rep(i, 4) mp[s[i]]++;
  string ans = "Yes";
  for (char c: s) {
    if (mp[c]!=2) ans = "No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define forit(it,a) for(auto it=(a).begin();it!=(a).end();it++)
#define forC(v) for(auto it = (v).begin();it!=(v).end();it++)cout << *it << " "
#define forM(v) for(auto it = (v).begin();it!=(v).end();it++)cout << it->second << " "
#define fori(i,n) for(auto i = 0 ; i < (n) ; i++)
#define endl "\n"
#define pll pair<ll,ll>

using namespace std;



int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	#ifdef REJUNTE
	freopen("TEXT.txt","r",stdin);
	#endif
	vector<ll>pot;
	multiset<ll> m;
	ll n,aux;
	cin >> n;
	while(n--){
		cin>>aux;
		m.insert(aux);
	}
	aux=*m.rbegin();
	ll mask=0;
	pot.push_back(1);
	while((1LL<<mask)<aux){mask++;pot.push_back((1LL<<mask));}
	pot.push_back((1LL<<mask+1));
	
	ll rta=0;
	multiset<ll>:: iterator it;
	while(!m.empty()&&m.size()!=1){
		it=prev(m.end());
		aux=*it;
		aux = *upper_bound(pot.begin(),pot.end(),aux)-aux;
		m.erase(next(--it));
		if(m.find(aux)!=m.end()){
			rta++;
			m.erase(m.find(aux));
		}
	}
	cout << rta << endl;
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {

    jaldi

    long long int a;
    long long int b;
    long long int c;
    long long int d;
    long long int ans;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    ans = max(max(max(a*d,a*c),b*c),b*d);
    cout<<ans<<'\n';
}


Measured memory_bytes: 3644
require 'prime'

# 約数リスト
def divisors(n)
  n.prime_division.inject([1]) do |array, (k, v)|
    (0..v).map{ |i| k ** i }.product(array).map{ |a, b| a * b }
  end.sort
end

n = gets.to_i
divs = divisors(n)
prime_divs = Prime.prime_division(n)
ans = divisors(n - 1)
divs.each do |d|
  dup_n = n
  while true
    div, mod = dup_n.divmod(d)
    if mod == 1
      ans << d
      break
    elsif mod == 0
      break if dup_n == div
      dup_n = div
    else
      break
    end
  end
end
ans.delete(1)
puts ans.uniq.size

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

using namespace std;


int main(){
string s1,s2;
cin>>s1>>s2;
int count=0;
	for(int i=0;i<s1.size();i++){
		if(s1[i]!=s2[i])
		count++;
	}
	cout<<count;
	return 0;
}




Measured memory_bytes: 3896
n,q=map(int,input().split())
s=input()
lr = [list(map(int, input().split())) for _ in range(q)]

ruisekiwa=[0]*n
for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        ruisekiwa[i+1]=ruisekiwa[i]+1
    else:
        ruisekiwa[i+1] = ruisekiwa[i]
for i in range(q):
    print(ruisekiwa[lr[i][1]-1]-ruisekiwa[lr[i][0]-1])


Measured memory_bytes: 30656
#include <iostream>
#include <string>
using namespace std;
int main(void) {
	long c,ans=0,i,j;
	string s;
	cin >> s;

	for(i=0;i<s.size();i++) {
		c=0;
		for (j=0;j<s.size();j++) {
			if (s[i]==s[j]) {
              c++;
        	}
		}
		if (c%2==1){
          ans=1;
        }
	}

	if (ans==0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
l = input()
n = len(l)
dp = [[[0] * 2 for _ in range(3)] for _ in range(n+1)]
dp[0][0][1] = 1

for i in range(n):
    for j in range(3):
        dp[i][j][0] %= MOD
        dp[i][j][1] %= MOD
        dp[i+1][0][0] += dp[i][j][0]
        dp[i+1][1][0] += dp[i][j][0]
        dp[i+1][2][0] += dp[i][j][0]
        if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1]

print(sum(map(lambda x: sum(x) % MOD, dp[n])) % MOD) 


Measured memory_bytes: 80476
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int cnt = 0;
		for(int j = 0; j < s.length(); j++) {
			if(s.charAt(j) == '2') {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 21844
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

struct point {double x,y;};

void koch(int n,point a,point b){
    if(n == 0)return;
    point s,u, t;
    double th = 3.141592653589793238462643383279 /3;
    s.x = (2.0*a.x+1.0*b.x)/3.0;
    s.y = (2.0*a.y+1.0*b.y)/3.0;
    t.x = (1.0*a.x+2.0*b.x)/3.0;
    t.y = (1.0*a.y+2.0*b.y)/3.0;
    u.x = (t.x-s.x)*cos(th) - (t.y-s.y)*sin(th)+s.x ;
    u.y = (t.x-s.x)*sin(th) + (t.y-s.y)*cos(th)+s.y;

    koch(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    koch(n-1,t,b); 
}

int main(){
    point a,b;
    int n;
    cin >> n;
    a.x = 0.0;
    a.y = 0.0;
    b.x = 100.0;
    b.y = 0.0;

    printf("%.8f %.8f\n",a.x,a.y);
    koch(n,a,b);
    printf("%.8f %.8f\n",b.x,b.y);

    return 0;
}


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

def dfs(a, used=0):
    if len(a)==n:
        print(''.join(a))
    else:
        for i in range(ord('a'), ord('a')+used+1):
            if i == ord('a')+used:
                dfs(a+[chr(i)], used+1)
            else:
                dfs(a+[chr(i)], used)

dfs([], 0)


Measured memory_bytes: 9096
#include <bits/stdc++.h>
using namespace std;
void funDP(vector<int>t) {
	vector<int>dp(t.size()+1, 0);
	dp[0] = 0;
	dp[1] = abs(t[1] - t[0]);
	for (int i = 2; i < t.size(); i++) {
			dp[i] = min(dp[i - 2] + abs(t[i] - t[i - 2]),dp[i - 1] + abs(t[i] - t[i - 1]));
	}
	cout << dp[t.size() - 1]<<"\n";
}
int main()
{
	int r;
	cin >> r;
	
	vector<int>v(r);
	for (auto&& x : v)
		cin >> x;
	funDP(v);
	return 0;
}


Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  3 14:57:33 2019

@author: Tomomasa Takahashi
"""

S=input()
tot = 0
lcont=0
scont=0
for i in range(len(S)):
    if S[i]=='<':
        lcont += 1
    else:
        scont += 1
    if i < len(S)-1:
        if S[i]==">" and S[i+1]=='<':
            t = max(lcont, scont)
            s = min(lcont, scont)-1
            tot += t*(t+1)//2
            tot += s*(s+1)//2
            lcont=0
            scont=0
t = max(lcont, scont)
s = min(lcont, scont)-1
tot += t*(t+1)//2
tot += s*(s+1)//2
print(tot)

Measured memory_bytes: 4128
arr = []
line = gets.chomp
add = ""
line.each_char{|c|
    if c == ',' || c == '.' || c == ' '
        arr << add if add.length.between?(3, 6)
        add = ""
    else
        add += c
    end
}
arr << add if add.length.between?(3, 6)
puts arr.join(" ")


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

int main(){
	int a,b;
	cin>>a>>b;
	if(a<b){
		cout<<"a < b"<<endl;
	}
	if(a>b){
		cout<<"a > b"<<endl;
	}
	if(a==b){
		cout<<"a == b"<< endl;
	}
	return 0;
}

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

int main(){
    int a[4];
    for(int i=0; i<4; i++) cin >> a[i];
    
    if((abs(a[0] - a[1]) <= a[3]) && (abs(a[1] - a[2]) <= a[3]) || abs(a[0] - a[2]) <= a[3]){
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)

using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;

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 (a>b) { a=b; return 1; } return 0; }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

int main()
{
    double W, H, x, y; cin >> W >> H >> x >> y;
    int is_multi = 0;
    if (x == W / 2.0 && y == H / 2.0) {
        is_multi = 1;
    }

    cout << W * H / 2.0 << " " << is_multi << endl;

    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
s=input()
first=0
for i in range(n):
  if s[i]=='L':
    if i!=n-1: 
      if s[i+1]=='L':
        first+=1
  else:
    if i!=0:
      if s[i-1]=='R':
        first+=1
ans=min(n-1,first+2*k)
print(ans)


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}

	Scanner sc = new Scanner(System.in);

	void run() {

		for (;;) {
			long n = sc.nextInt();
			if (n == 0) {
				break;
			}
			
			long left = n;
			int size = 1;

			for(int i = 1; ;i++){
				
				if(i % 2 == 0){
					if((n - i/2)/i - i/2 +1<= 0){
						break;
					}
					if((n - i/2) % i == 0){
						left = (n - i/2)/i - i/2+1;
						size = i;
					}
				}else{
					if( n/i - i/2 <= 0){
						break;
					}
					if(n % i == 0){
						left = n/i - i/2;
						size = i;
					}					
				}
			}

			System.out.println(left+" "+size);
		}

	}
}



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

int main(){
    vector<int> abc(3);
    cin>>abc[0]>>abc[1]>>abc[2];
    
    sort(abc.begin(),abc.end());
    cout<<abc[0]<<" "<<abc[1]<<" "<<abc[2]<<endl;    
}


Measured memory_bytes: 3088
N=int(input())
huga = list(map(int, input().split()))

m=10**9+7
for i in range(0,100):
  p=i+1
  a=0
  for j in range(0,N):
    a=a+(huga[j]-p)**2
  m=min(a,m)
  
print(m)

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

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

 for(int i = 1; i <= n; i++){
   if(i%3 == 0) continue;
   if(i%5 == 0) continue;
   ans += i;
 }

cout << ans << endl;

return 0;
}

Measured memory_bytes: 3576