akhauriyash/Code-Regression huggingface dataset:
A, B, C, D = list(input())

for i in range(8):
    op1 = "+" if i & 1 else "-"
    op2 = "+" if i & 2 else "-"
    op3 = "+" if i & 4 else "-"
    S = "{}{}{}{}{}{}{}".format(A, op1, B, op2, C, op3, D)
    if eval(S) == 7:
        print(S + "=7")
        quit()


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int k,x;
cin>>k>>x;

rep(i,x-k+1,x+k-1)
{
	ol(i);os;
}

return 0;
}



Measured memory_bytes: 256
params = input().split(' ')
takahashi_monster = {
    'life': int(params[0]),
    'attack': int(params[1]),
    'dead': False
}
aoki_monster = {
    'life': int(params[2]),
    'attack': int(params[3]),
    'dead': False
}

while takahashi_monster['dead'] == False and aoki_monster['dead'] == False:
    aoki_monster['life'] = aoki_monster['life'] - takahashi_monster['attack']
    if aoki_monster['life'] <= 0:
        aoki_monster['dead'] = True
        print('Yes')
        break
    takahashi_monster['life'] = takahashi_monster['life'] - aoki_monster['attack']
    if takahashi_monster['life'] <= 0:
        takahashi_monster['dead'] = True
        print('No')
        break



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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll n, m, d;
  cin >> n >> m >> d;
  if(d==0){
    cout <<setprecision(15)<< (double)(m-1)/n;
  }else{
    cout <<setprecision(15)<< (double)2*(n-d)*(m-1)/n/n;    
  }
  return 0;
}


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

int main()
{
	int N, p, q, r, S, S1;
	int W[128];
	S = 0;
	scanf("%d", &N);
	for (p = 1; p < N + 1; p++) 
	{
		scanf("%d", &W[p]);
	}
	for (q = 1; q < N + 1; q++)
	{
		S += W[q];
	}
	S1 = S;
	for (r = 1; r < N + 1; r++) 
	{
		if (abs(S1) > abs(S1 - 2 * W[r])) 
		{
			S1 -= 2 * W[r];
		}
		else { break; }
	}
	printf("%d", abs(S1));

	return 0;
}

Measured memory_bytes: 128
def saiki(s,n,x)
  return if(s.include?(x.to_s))
  s += x.to_s
  if(s.size == n)
    @ans += 1
    return
  end
  @t[x].each do |d|
    saiki(s ,n,d)
  end
end
@ans = 0
n, m = gets.chomp.split(" ").map(&:to_i)
@t = Array.new(n+1)
(n+1).times do |d|
  @t[d] = []
end
m.times do 
  a, b = gets.chomp.split(" ").map(&:to_i)
  @t[a].push(b)
  @t[b].push(a)
end
saiki("",n,1)
p @ans

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>

using namespace std;

typedef struct MAZE {
    char path;
    int cost;
} Maze;

int bfs (Maze **, int, int, int, int);
int blacks (Maze **, int, int);

int main (void)
{
    int h, w;
    Maze **maze;

    cin >> h >> w;
    maze = (Maze **)malloc(sizeof(Maze *) * (h + 2));
    for (int i = 0; i < h + 2; i++) {
        maze[i] = (Maze *)malloc(sizeof(Maze) * (w + 2));
    }

    // 周囲に壁を作っておく
    for (int i = 0; i < w + 2; i++) {
        maze[0][i].path = '#';
        maze[h+1][i].path = '#';
    }
    for (int i = 0; i < h + 2; i++) {
        maze[i][0].path = '#';
        maze[i][w+1].path = '#';
    }
    // ここまで

    // 迷路の入力
    for (int i = 1; i < h + 1; i++) {
        for (int j = 1; j < w + 1; j++) {
            cin >> maze[i][j].path;
            maze[i][j].cost = 0;
        }
    }
    // ここまで

    int black = blacks(maze, h, w);
    int min_dist = bfs(maze, 1, 1, h, w);

    if (min_dist == 0) {
        cout << "-1" << endl;
    } else {
        cout << h * w - min_dist - black - 1 << endl;
    }

    for (int i = 0; i < h; i++) {
        free(maze[i]);
    }
    free(maze);

    return 0;
}

int bfs (Maze **maze, int sy, int sx, int gy, int gx)
{
    std::queue<int> que_x;
    std::queue<int> que_y;

    // 四近傍にforループでアクセスするための配列
    int vx[] = {0, 1, 0, -1};
    int vy[] = {1, 0, -1, 0};

    que_x.push(sx);
    que_y.push(sy);

    while (true) {
        if (que_x.empty() || que_y.empty()) {
            break;
        }
        for (int i = 0; i < 4; i++) {
            // キューからひとつ取り出す
            int nx = que_x.front() + vx[i];
            int ny = que_y.front() + vy[i];
            // 四近傍を見て、到達可能ならキューに追加
            if (maze[nx][ny].path == '.') {
                que_x.push(nx);
                que_y.push(ny);
                maze[nx][ny].cost = maze[que_x.front()][que_y.front()].cost + 1;
                maze[nx][ny].path = '#';
            }
        }
        que_x.pop();
        que_y.pop();
    }

    return maze[gy][gx].cost;
}

int blacks (Maze **maze, int h, int w)
{
    int cnt = 0;

    for (int i = 1; i < h + 1; i++) {
        for (int j = 1; j < w + 1; j++) {
            if (maze[i][j].path == '#') {
                cnt++;
            }
        }
    }

    return cnt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2147483647;
using namespace std;

const int sqrtN = 512;

class sqdiv{
    public:
        int N, K;
        vector<int> data;
        vector<int> bkt;
        sqdiv(int n){ //?????±???????????????????????´
            N = n;
            K = (N + sqrtN - 1) / sqrtN;
            data.assign(K * sqrtN, INF);
            bkt.assign(K, INF);
        }
        void update(int x, int y){
            int k = x / sqrtN;
            data[x] = y;
            int mini = INF;
            for(int i = k * sqrtN; i < (k + 1) * sqrtN; i++){
                mini = min(mini, data[i]);
            }
            bkt[k] = mini;
        }
        int find(int x, int y){
            int mini = INF;
            rep(k,K){
                int l = k * sqrtN, r = (k + 1) * sqrtN;
                if(r <= x || y <= l) continue;
                if(x <= l && r <= y){
                    mini = min(mini, bkt[k]);
                }else{
                    for(int i = max(x, l); i < min(y, r); i++){
                        mini = min(mini, data[i]);
                    }
                }
            }
            return mini;
        }
};

int main(){
    int n,q;
    cin >> n >> q;
    sqdiv ob(n);
    rep(i,q){
        bool com;
        int a, b;
        cin >> com >> a >> b;
        if(com){
            cout << ob.find(a,b + 1) << endl;
        }else{
            ob.update(a,b);
        }
    }
}

Measured memory_bytes: 3328
#include<stdio.h>
void insertionSort(int [],int);// N個の要素を含む0-オリジンの配列A
void trace(int [],int);

int main(){
  int N,i,j;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  trace(A,N);
  insertionSort(A,N);
  
  return 0;
}

//配列の要素を順番を出力
void trace(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}


//挿入
void insertionSort(int A[],int N){
  int j,i,v;
  for (i = 1;i<N;i++){
    v = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    trace(A,N);
  }
}



Measured memory_bytes: 2732
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;
ll MOD=998244353;


int main(){
    ll N,M;
    cin>>N>>M;
    vector<ll> H(N);
    vector<vector<ll>> v(N);
    for(ll i=0;i<N;i++){
        cin>>H[i];
    }
    for(ll i=0;i<M;i++){
        ll a,b;
        cin>>a>>b;
        a--;b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    ll res=0;
    map<ll,bool>mp;
    for(ll i=0;i<N;i++){
        if(mp[i])continue;
        bool ok=true;
        for(ll j=0;j<v[i].size();j++){
            if(H[v[i][j]]>=H[i])ok=false;
        }
        if(ok){
            res++;
            // cout<<i<<endl;
            for(ll j=0;j<v[i].size();j++){
                mp[v[i][j]] = true;
            }
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 16196
n,a,b,c = map(int,input().split())

ko = [int(input()) for i in range(n)]
INF = 10**9

def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(w,e,r) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[q],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

print(dfs(0,0,0,0))


Measured memory_bytes: 3064
import java.util.*;
 
 
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int total = N * A;
    
    if (total > B) {
      total = B;
    }
  	
    System.out.print(total);
	}
}

Measured memory_bytes: 22740
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;
using static Read;

class Program
{
    public static void Main()
    {
        string[] list = { "a", "i", "u", "e", "o" };
        var n = String();
        if(list.ToList().IndexOf(n) >= 0)
        {
            WriteLine($"vowel");
        }
        else
        {
            WriteLine($"consonant");
        }
    }
}

static class Read
{
    static Queue<string> queue = new Queue<string>();
    static void Enqueue()
    {
        ReadLine().Split(' ').ToList().ForEach(a => queue.Enqueue(a));
    }
    public static int Int()
    {
        if(queue.Count == 0)
            Enqueue();
        return int.Parse(queue.Dequeue());
    }
    public static long Long()
    {
        if(queue.Count == 0)
            Enqueue();
        return long.Parse(queue.Dequeue());
    }
    public static double Double()
    {
        if(queue.Count == 0)
            Enqueue();
        return double.Parse(queue.Dequeue());
    }
    public static string String()
    {
        if(queue.Count == 0)
            Enqueue();
        return queue.Dequeue();
    }
    public static int[] IntArray()
    {
        return ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static long[] LongArray()
    {
        return ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
    }
    public static double[] DoubleArray()
    {
        return ReadLine().Split(' ').Select(a => double.Parse(a)).ToArray();
    }
    public static string[] StringArray()
    {
        return ReadLine().Split(' ');
    }
}


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> a(3 * N), d(N + 1, 0), e(N + 1, 0);
    rep(i, 3 * N) cin >> a[i];
    priority_queue<int> b, c;
    rep(i, N) {
        b.push(-a[i]);
        d[0] += a[i];
    }
    rep(i, N) {
        b.push(-a[i + N]);
        d[i + 1] = d[i] + a[i + N];
        int x = b.top();
        b.pop();
        d[i + 1] += x;
    }
    rep(i, N) {
        c.push(a[2 * N + i]);
        e[0] += a[2 * N + i];
    }
    rep(i, N) {
        c.push(a[2 * N - 1 - i]);
        e[i + 1] = e[i] + a[2 * N - 1 - i];
        int x = c.top();
        c.pop();
        e[i + 1] -= x;
    }
    ll ans = -1e18;
    rep(i, N + 1) {
        if (d[N - i] - e[i] > ans) ans = d[N - i] - e[i];
    }
    cout << ans << endl;
    //rep(i, N + 1) cout << d[i] << " " << e[i] << endl;
}

Measured memory_bytes: 5368
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

#define maxs(x,y) (x=std::max(x,y))
#define mins(x,y) (x=std::min(x,y))

int main() {
  string S;
  cin >> S;
  bool is_hitach = true;
  if (S.size()%2 == 1) {
    is_hitach = false;
  } else {
    int c = S.size()/2;
    for (auto i = 0;i < c;++i) {
      if (S[i*2] == 'h' && S[i*2+1] == 'i') {
        continue;
      } else {
        is_hitach = false;
        break;
      }
    }
  }
  if (is_hitach == true) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 888
#include <stdio.h>

#define EV(X) \
  ( (X) == 'I' ? 1 \
  : (X) == 'V' ? 5 \
  : (X) == 'X' ? 10 \
  : (X) == 'L' ? 50 \
  : (X) == 'C' ? 100 \
  : (X) == 'D' ? 500 \
  : (X) == 'M' ? 1000 \
  : 0 ) \

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char  s[ 128 ];

  while ( scanf ( "%s", s ) == 1 )
  {
    char * p;
    int res = 0;

    for ( p = s; *p != '\0'; ++p )
    {
      res += EV( p[ 0 ] ) < EV( p[ 1 ] )
           ? -EV( *p ) : EV( *p );
    }

    printf ( "%d\n", res );
  }

  return ( 0 );
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))

rate = [0 for _ in range(9)]
#print(rate)
for i in a:
  if 1<=i<=399:
    rate[0]+=1
  elif 400<=i<=799:
    rate[1]+=1
  elif 800<=i<=1199:
    rate[2]+=1
  elif 1200<=i<=1599:
    rate[3]+=1
  elif 1600<=i<=1999:
    rate[4]+=1
  elif 2000<=i<=2399:
    rate[5]+=1
  elif 2400<=i<=2799:
    rate[6]+=1
  elif 2800<=i<=3199:
    rate[7]+=1
  else:
    rate[8]+=1
    
#print(rate)

ans = 0

for j in range(8):
  if rate[j] != 0:
    ans += 1
if ans!=0:
  print(ans, ans+rate[8])
else:
  print(1, rate[8])

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    vector<pii> v(n);
    for (auto &p : v) {
        int a, b;
        cin >> a >> b;
        p = pii(a, b);
    }
    v.emplace_back(0, 1);

    bool exist = false;
    int cnt = 0;
    for (int i = 0; i <= n; i++) {
        if (v[i].first == v[i].second) cnt++;
        else {
            if (cnt >= 3) exist = true;
            cnt = 0;
        }
    }
    if (exist) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <set>
#define int long long
using namespace std;

int arr[100010][3],dp[100010][3];

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n,i,j;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<3;j++)
		{
			cin>>arr[i][j];
			dp[i][j]=max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + arr[i][j];
		}
	}
	cout<<max({dp[n][0], dp[n][1], dp[n][2]})<<'\n';
	
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#define endl '\n' 

int n;
int aa[200001];
int bb[200001];
pair<int,int> cc[200001];
int ans[200001];
int par[200001];
int ss[200001];
int mi[200001];
int find(int no){
	if(par[no]==no){
		return no;
	}
	par[no]=find(par[no]);
	return par[no];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>aa[i]>>bb[i];
		aa[i]--;
		bb[i]--;
		cc[aa[i]]={bb[i],i};
	}

	for(int i=0;i<n;i++){
		par[i]=i;
		ss[i]=1;
		mi[i]=cc[i].a;
	}
	set<pair<int,int>> cur;
	for(int i=0;i<n;i++){
		vector<pair<int,int>> kk;
		for(auto j:cur){
			if(j.a>cc[i].a){
				break;
			}
			int x=find(j.b);
			int y=find(i);
			par[x]=y;
			ss[y]+=ss[x];
			mi[y]=min(mi[y],mi[x]);
			kk.pb(j);
		}
		cur.insert({mi[i],i});
		for(auto j:kk){
			cur.erase(j);
		}
	}


	for(int i=0;i<n;i++){
		ans[cc[i].b]=ss[find(i)];
	}

	for(int i=0;i<n;i++){
		cout<<ans[i]<<endl;
	}


	return 0;
}

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

namespace ForAtcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            long count;
            var result = 0;
            for (var i = 1; i <= n; i += 2)
            {
                count = 0;
                for (var j = 1; j <= i; j++)
                {
                    if (i % j == 0) count++;
                }
                if (count == 8) result++;
            }
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10 ;
int n ;
vector<int> v  ;
int dp[100010] ;
int dfs(int x){
    if ( x == n - 1 ){
        return 0 ;
    }
    if ( dp[x] != -1 ) return dp[x] ;
    int choice1 = INF ;
    int choice2 = INF ;
    if ( x + 1 < n )
        choice1 = abs(v[x] - v[x + 1]) + dfs(x + 1) ;
    if ( x + 2 < n )
        choice2 = abs(v[x] - v[x + 2]) + dfs(x + 2) ;


    return dp[x] = min(choice1, choice2) ;

}

int main(){
    memset(dp, -1, sizeof dp) ;
    cin >> n ;
    v.resize(n) ;
    for(int i = 0; i < n; i++){
        cin >> v[i] ;
    }

    int ans = dfs(0) ;

    cout << ans << endl;

    return 0 ;
}

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

struct per{
	int tar;
	bool judge;
};
vector<per> P[15];
int A[15];
bool person[15];

int main(){
	int N,a,b,count=0,maxP=0;
	bool judge,pre;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
		for(int j=0;j<A[i];j++){
			cin>>a>>b;
			P[i].push_back({a-1,b});
		}
	}
	for(int i=0;i<(1<<N);i++){
		for(int j=0;j<N;j++)person[j]=((i>>j)&1);
		judge=true;
		count=0;
		for(int j=0;j<N;j++){
			if(person[j]){
				pre=true;
				for(int k=0;k<A[j];k++)pre &= (person[P[j][k].tar]==P[j][k].judge);
				if(pre)count++;
				else judge=false;
			}
		}
		if(judge)maxP=max(maxP,count);
	}
	cout<<maxP;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  int K;
  cin >> N >> K;
  
  int num;
  int num2;
  
  vector<int> x(N);
  
  int num3 = 0;
  
  for(int i = 0;i < N;++i){
    cin >> x[i];
  }
  
  for(int i = 0;i < N;++i){
    num = abs(x[i] - 0) * 2;
    num2 = abs(x[i] - K) * 2;
    if(num >= num2){
      num3 = num2 + num3;
    }
    else{
      num3 = num + num3;
    }
  }
  
  cout << num3 << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a1,a2,a3,a4,b=0;
	for(int i=0;i<2;i++){
		cin >> a1 >> a2 >> a3 >> a4;
		if(a1+a2+a3+a4>=b)b=a1+a2+a3+a4;
	}
	cout << b <<endl;
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> res(M);
    for(int i=0; i<M; i++){
        res[i] = 0;
    }

    int K, A;
    for(int i=0; i<N; i++){
        cin >> K;
        for(int j=0; j<K; j++){
            cin >> A;
            res[A-1] += 1;
        }
    }

    int ans = 0;
    for(int i=0; i<M; i++){
        if(res[i] == N) ans +=1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Numerics;
using System.Linq;

namespace AtCoder
{
    class Abc170B
    {
        public static void Main()
        {
            var xy = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var x = xy[0];
            var y = xy[1];

            if (y % 2 == 0 && 4 * x >= y && y >= 2 * x )
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 28292
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	
	int L;
	cin>>L;
	int D = L;
	
	vector<vector<pair<int,int>>> E(1,vector<pair<int,int>>());
	for(int i=0;i<20;i++){
		E.push_back(vector<pair<int,int>>());
		if((1<<i)<L){
			L-=(1<<i);
			E[i].emplace_back(i+1,(1<<i));
			E[i].emplace_back(i+1,0);
		}
		else{
			E.pop_back();
			break;
		}
	}

	for(int i=E.size()-2;i>=0;i--){
		int t = (1<<i);
		if(L>t){
			E[i].emplace_back(E.size()-1,D-L+1);
			L-=t;
		}
	}
	
	int N = E.size();
	int M = 0;
	for(int i=0;i<N;i++)M += E[i].size();
	cout<<N<<' '<<M<<endl;
	for(int i=0;i<N;i++){
		for(int j=0;j<E[i].size();j++){
			cout<<i+1<<' '<<E[i][j].first+1<<' '<<E[i][j].second<<endl;
		}
	}
	
	return 0;
}

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

int main(void)
{
  int i, n, x;
  cin >> n;
  for (i = 1; i < n + 1; i++) {
    x = i;
    if(x % 3 == 0) {
      cout << " " << i;
    }
    else{
      while(x != 0){
        if(x % 10 == 3) {
          cout << " " << i;
          break;
        }
        x /= 10;
      }
    }
  }
  cout << endl;
}

Measured memory_bytes: 1160
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int h,w,m,ans=0; cin>>h>>w>>m;
    vector<pp> hcnt(h,mk(0,0)),wcnt(w,mk(0,0));
    rep(i,h) hcnt[i].second=i;
    rep(i,w) wcnt[i].second=i;
    set<pp> s;
    rep(i,m){
        int a,b; cin>>a>>b;
        a--; b--;
        s.insert(mk(a,b));
        hcnt[a].first++; wcnt[b].first++;
    }
    for(auto p:s){
        ans=max(ans,hcnt[p.first].first+wcnt[p.second].first-1);
        //cout<<hcnt[p.first].first+wcnt[p.second].first-1<<endl;
    }
    sort(al(wcnt));
    reverse(al(wcnt));
    rep(i,h){
        rep(j,w){
            if(s.count(mk(i,wcnt[j].second))) continue;
            else{
                ans=max(ans,hcnt[i].first+wcnt[j].first);
                //cout<<hcnt[i].first+wcnt[j].first<<j<<endl;
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 21972
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MOD 998244353
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int gcd(const int &a, const int &b) {return b ? gcd(b, a % b) : a;}

int N, a[100005];
ll ans = 1;

int main(){
	getint(N);
	for(register int i = 1; i <= N; i++) getint(a[i]);
	sort(a + 1, a + N + 1);
	for(register int i = 0; i < N; i++) ans = ans * (ll)gcd(i, a[i + 1]) % MOD;
	return printf("%lld\n", ans), 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
 int N;cin>>N;
  string str;
 stack<char> st;
 for (int i = 0; i < N; i++)
 {
   char X;cin>>X;
   str += X;
   if(st.size() == 0)
   {
     st.push(X);
   }
   else
   {
     if(X == '(')
     {
       st.push(X);
     }
     else
     {
       if(st.top() == '(')
       {
         st.pop();
       }
       else
       {
         st.push(X);
       }
       
     }
     
   }
   
 }
  int num_x = 0,num_y = 0;
  while(!st.empty())
  {
    char X = st.top();
    st.pop();
    if(X == '(') num_x++;
    else num_y++;
  }
  string s1 (num_x,')');
  string s2 (num_y,'(');
  s2 += str;
  s2 += s1;
  cout<<s2<<endl;
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  string s, t;
  cin >> s >> t;
  int n = (int)s.size() - t.size() + 1;
  int min = (int)t.size();
  rep(i,n){
    int index = (int)t.size();
    rep(j,(int)t.size()){
      if (s.at(i+j) == t.at(j)){
        index--;
      }
    }
    if (index<min){
      min = index;
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cout << 0 << endl;
    cin >> s;
    if(s == "Vacant"){
        return 0;
    }
    int ok = n;
    int ng = 0;
    string tmp;
    while(tmp!="Vacant")
    {
        int mid = (ok + ng) / 2;
        cout << mid << endl;
        cin >> tmp;
        if(mid%2^tmp==s){
            ng = mid;
        }
        else
        {
            ok = mid;
        }
    }
    return 0;
}

Measured memory_bytes: 852
#include<bits/stdc++.h>
#define ll long long
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl;
using namespace std;
int n,k;
int a[105];
int memo[100005][2];
int dp(int rem,int move)
{
    //watch(move)
    if(rem<0)
    {
        return 1;
    }
    if(memo[rem][move]!=-1)
    {
        return memo[rem][move];
    }
    int flag=0;
    for(int i=0;i<n;++i)
    {
        int ret;
        ret=dp(rem-a[i],move^1);
        if(ret==0)
        {
            flag=1;
        }
    }
    return memo[rem][move]=flag;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;++i)
    {
        scanf("%d",&a[i]);
    }
    memset(memo,-1,sizeof memo);
    if(dp(k,0))
    {
        printf("First\n");
    }
    else
    {
        printf("Second\n");
    }
    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	int t=0;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		if(a==t+1) t++;
	}
	if(t==0) cout << -1 << endl;
	else cout << n-t << endl;
	return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n,m;cin >>n>>m;
    vector<P>p(n);
    for (int i = 0; i < n; ++i) {
        ll a,b;cin >>a>>b;
        p[i]={a,b};
    }
    sort(all(p));
    priority_queue<ll>que;
    ll ans=0;
    ll k=0;
    for (int i = 1; i <=m; ++i) {
            while(k<n&&p[k].first<=i) {
                que.push(p[k].second);
                k++;
            }
        if(!que.empty()) {
            ll u = que.top();
            que.pop();
//            cout <<u<<endl;
            ans += u;
        }
    }
    cout <<ans <<endl;
    return 0;
}


Measured memory_bytes: 5860
#include <iostream>
#include <vector>

using namespace std;


int main() {
    int N, K;
    vector<int> l;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        int n;
        cin >> n;
        l.push_back(n);
    }
    sort(l.begin(), l.end(), greater<int>());
    int sum = 0;
    for (int i = 0; i < K; i++) {
        sum += l[i];
    }
    cout << sum << endl;
}


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

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

cakeList = []
for i in range(1, X + 1):
    for j in range(1, Y + 1):
        for k in range(1, Z + 1):
            if i * j * k <= K:
                cakeList.append(A[i - 1] + B[j - 1] + C[k - 1])
            else:
                break

cakeList.sort(reverse = True)

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

Measured memory_bytes: 15488
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int density[15][15];
const int dr[] = { 0,-1, 0, 1, 0 };
const int dc[] = { 0, 0, 1, 0,-1 };

int main()
{
//	cut here before submit 
//	freopen ("testcase.DI", "r", stdin );
	memset (density, 0, sizeof (density ) );
	string str = "";
	while (getline (cin, str ) ){
		int n = str.length();
		rep (i, n ){
			if (str[i] == ',' ) str[i] = ' ';
		} // end rep
		stringstream ss (str );
		int col, row, size;
		ss >> col >> row >> size;
		switch (size ){
			case 1:	// small
				rep (k, 5 ){
					int nr = row + dr[k];
					int nc = col + dc[k];
					if (nr < 0 || nr >= 10 || nc < 0 || nc >= 10 ) continue;
					density[nr][nc]++;
				} // end rep
				break;
			case 2:	// medium
				for (int drow = -1; drow <= 1; drow++ ){
					for (int dcol = -1; dcol <= 1; dcol++ ){
						int nr = row + drow;
						int nc = col + dcol;
						if (nr < 0 || nr >= 10 || nc < 0 || nc >= 10 ) continue;
						density[nr][nc]++;
					} // end for
				} // end for
				break;
			case 3:	// large
				for (int drow = -1; drow <= 1; drow++ ){
					for (int dcol = -1; dcol <= 1; dcol++ ){
						int nr = row + drow;
						int nc = col + dcol;
						if (nr < 0 || nr >= 10 || nc < 0 || nc >= 10 ) continue;
						density[nr][nc]++;
					} // end for
				} // end for
				for (int k = 1; k < 5; k++ ){
					int nr = row + 2*dr[k];
					int nc = col + 2*dc[k];
					if (nr < 0 || nr >= 10 || nc < 0 || nc >= 10 ) continue;
					density[nr][nc]++;
				} // end for
				break;
		} // end switch
	} // end while
	int noink = 0;
	int max_density = 0;
	rep (i, 10 ) rep (j, 10 ){
		if (density[i][j] == 0 ) noink++;
		else
			max_density = max (max_density, density[i][j] );
	} // end rep
	cout << noink << endl;
	cout << max_density << endl;
		
	return 0;
}

Measured memory_bytes: 1220
program shopping_street
  implicit none
  integer, parameter :: ubnd = 2**10 - 1
  integer :: n, f(100,10), p(100,0:10)
  integer :: i, j, k, op, g(ubnd), s(100)
  f = 0
  p = 0
  g = 0
  read(*,*) n
  do i = 1, n
    read(*,*) f(i,1:10)
  end do
  do i = 1, n
    read(*,*) p(i,0:10)
  end do
  do k = 1, ubnd
    s = 0
    do j = 1, 10
      if (btest(k,j-1)) then
        s(1:n) = s(1:n) + f(1:n,j)
      end if
    end do
    do i = 1, n
      g(k) = g(k) + p(i,s(i))
    end do
  end do
  write(*,'(i0)') maxval(g)
end program shopping_street

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

#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl

using namespace std;
typedef long long ll;

const int maxn = 55;

int a[maxn];

int main(){
    int n;
    cin >> n;
    int dis = 0;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        if (a[i] != i) dis++;
    }
    if (dis == 0 or dis == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> Rs(1);

    if (S[0] == '1')
        Rs[0] = 0;
    else
        Rs.push_back(0);

    int before = (int)S[0];

    rep(i, N) {
        int s = (int)S[i];
        if (s != before) {
            Rs.push_back(0);
        }
        Rs[Rs.size() - 1]++;
        before = s;
    }
    if(Rs.back() == 0) Rs.push_back(0);

    // if (K * 2 + 1 >= Rs.size()) {
    //     cout << S.size() << endl;
    //     return 0;
    // }

    vector<int> sums(Rs.size()+1,0);
    rep(i, Rs.size()) sums[i+1] = sums[i] + Rs[i];

    int mx = 0;
    for(int left=0;left<sums.size();left+=2){
      int right = left + K*2+1;
      if(right >= sums.size()) right = sums.size() - 1;
      mx = max(mx,sums[right] - sums[left]);
    }

    cout << mx << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v (n);
    vector<int> c (n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    for(int i=0; i<n; i++){
        cin >> c.at(i);
    }
    int ans = 0;
    for(int i=0; i<n; i++){
        if(v.at(i)-c.at(i) > 0) ans+=v.at(i)-c.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*input
box
*/

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

int main() {
  string s;
  cin >> s;
  int l = s.size();
  if (s[l-1] == 's') s += "es";
  else s += "s";
  cout << s << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str=sc.next();
        if (str.charAt(2)==str.charAt(3) && str.charAt(4)==str.charAt(5))
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}


Measured memory_bytes: 21844
class UnionFind(object):
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for i in range(n)]
        self.value=n*(n-1)//2


    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])


    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.value-=self.size[y]*self.size[x]
        self.size[x]+=self.size[y]
        self.size[y]=self.size[x]

        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

n, m  =  map(int, input().split())
U=UnionFind(n)
ans=[U.value]
ab = [list(map(int, input().split())) for _ in range(m)]
for abi in ab[:0:-1]:
    a, b = abi
    U.unite(a-1, b-1)
    ans.append(U.value)
for i in ans[::-1]:
    print(i)

Measured memory_bytes: 38924
#include<bits/stdc++.h>
using namespace std;
//define
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define elif else if
//vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
//queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
//mapdefine
#define mint map<int>
#define mc map<char>
//pairdefine
#define pint pair<int,int>
#define pis pair<int,str>
#define pic pair<int,char>
#define pci pair<char,int>
#define mod 100000007
//main
signed main(){
  int N,M,O,P,count=0,count2=mod,count3=0,stack=0;
  str S,T;
  double l,s;
  vc ST(4);
  rep(0,4){
    cin>>ST[i];
  }
  sort(all(ST));
  if(ST[0]==ST[1]&&ST[2]==ST[3]&&ST[0]!=ST[3])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

using namespace std;

using u32 = uint32_t;
using u64 = uint64_t;
using i64 = int64_t;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= a; i--)
#define RF0(i,b) RFO(i,0,b)
#define F first
#define S second
#define ADD(a,b) (((u64)a + b)%MOD)
#define MUL(a,b) (((u64)a * b)%MOD)

constexpr int MOD = 998244353;

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

  int H, W;
  cin >> H >> W;

  u64 result;
  if (H == 1 || W == 1) {
    result = 1;
  }
  else {
    u64 a = ((u64)W + 1) / 2, b = ((u64)W) / 2;
    u64 c = ((u64)H + 1) / 2, d = ((u64)H) / 2;

    result = a * c + b * d;
  }


  cout << result;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  rep(i,n){
    ll A,B;
    cin>>A>>B;
    if(A > B) swap(A,B);
    /*
      1    …  A-1  (A)  A+1 … X
      A+B-1 … B+1  (B)  X-A … 1

      <- A-1人 ->      <- X-A人 ->

      縦の積がABを超えないようにしたときXを最大化する

      B > X-A かつ A < X
      A+B > X > A

     */

    // C^2 < AB となる最大のCを探す
    // A==B または A+1==BのときはC==Aとなるので場合分け
  
    if(A == B || A+1 == B){

      cout<<2*(A-1)<<endl;
      /*
	(A) A+1 … 2A-1
	(B) A-1 … 1 
       */

    }else{

      ll C = sqrt(A*B);
      if(C*C == A*B) C--;

      /*

	(A) A+1  …  C  C+1 …  2C
	(B) 2C-A  … C+1  C  …  1   

	    <-     2C-A人     ->

	C*(C+1) < AB ならばこれが最大
	そうでなければ
 
	(A) A+1  …  C  C+1 …  2C-1
        (B) 2C-A-1 … C C-1 …  1  

            <-    2C-A-1人     -> 
       */

      if((C+1)*C < A*B){

	cout << A-1 + 2*C-A  << endl; 

      }else{

	cout << A-1 + 2*C-A-1 << endl;

      }

    }

  }
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNext()) {
			
			String in = sc.nextLine();
			String[] ins = in.split(",");
			
			int num = Integer.parseInt(ins[0]);
			double wei = Double.parseDouble(ins[1]);
			double hei = Double.parseDouble(ins[2]);
			 
			if(25.0 <= wei/(hei*hei)){
				System.out.println(num);
			}
		}
	}
}

Measured memory_bytes: 17152
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <set>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define FOR(i,a,b) for (ll i = (a) ; i <= (b); ++i)
#define RFOR(i,a,b) for (ll i = (a) ; i >= (b); --i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい


void Main(){
	ll l, r, d;
	cin >> l >> r >> d;

	cout << r/d - (l-1)/d << endl;

}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 3636
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);
parse_tuple!(A, B, C, D);
parse_tuple!(A, B, C, D, E);

// ===

fn main() {
    let n: usize = read();
    let mut a: Vec<i32> = readnc();

    let mut cnt = 0;
    'outer: loop {
        for i in 0..n {
            if a[i] % 2 != 0 {
                break 'outer;
            }
            a[i] /= 2;
        }
        cnt += 1;
    }
    println!("{}", cnt);
}


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

int main(){
	int n;
	cin>>n;
	string ans="";
	while(n!=0){
		int a=(2+(n%2))%2;
		ans=to_string(a)+ans;
		n=(n-a)/(-2);
	}
	if(ans=="")ans="0";
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,j,n1,n2,count,key;
  int a[10000],b[500];
  count=0;

  scanf("%d",&n1);
  for(i=0;i<n1;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&b[i]);
  }

  for(i=0;i<n2;i++){
    key=b[i];
    for(j=0;j<n1;j++){
      if(a[j]==key){
	count++;
	break;
      }
    }
  }

  printf("%d\n",count);

  return 0;
}



Measured memory_bytes: 2104
#include<stdio.h>
#include<math.h>
#include<string.h>


int main()
{
	char A[10],B[10],C[10];
	scanf("%s",A);
	scanf("%s",B);
	scanf("%s",C);
	int length1 = strlen(A);
	int length2 = strlen(B);
		if(A[length1-1]==B[0] && B[length2-1]==C[0])
		{
			printf("YES");
		}
		else
			printf("NO");
	return 0;
}

Measured memory_bytes: 128