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

int N;
int cnt[110];

int main(){
    cin>>N;
    
    for (int i = 0; i < N; i++)
    {
        int x;
        cin>>x;
        cnt[x] = 1;
    }
        
    int ans=0;
    for (int i = 1; i <= 100; i++)
    {
        if(cnt[i] != 0) ans++;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int[] a = new int[5];
	int sum = 0;
	int min = 0;
	int minI = 0;
	for(int i = 0; i<5; i++) {
	    int num = sc.nextInt();
	    a[i] = num;
	    if(num%10!=0) {
		if(min == 0) {
		    min = num % 10;
		    minI = i;
		}
		else if(min> (num%10)) {
		    min = (num%10);
		    minI = i;
		}
	    }
        }
	for(int i = 0; i<5; i++) {
	    if(a[i]%10==0) {
		sum += a[i];
	    }else if(i == minI) {
		sum += a[i];
	    }else {
		int num = a[i];
		num = num/10;
		sum += (num+1)*10;

	    }
	}


	System.out.println(sum);
    }
}

Measured memory_bytes: 22100
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);
	printf("%lld\n", min(1ll * (A & 1) * B * C, min(1ll * A * (B & 1) * C, 1ll * A * B * (C & 1))));
	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, size):
        self.parent = [-1 for i in range(size)]#非負なら親ノード，負ならグループの要素数

    def root(self, x): #root(x): xの根ノードを返す．
        px=self.parent[x]
        if px < 0:
            return x
        ppx=self.parent[px]
        if ppx < 0:
            return px
        self.parent[px] = self.parent[x] = self.root(ppx) #xをxの根に直接つなぐ
        return self.parent[x]

    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき入れ替える
            x,y=y,x
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True

    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(x): xのいるグループの要素数を返す
        return -self.parent[self.root(x)]


n,m=[int(i) for i in input().split()]

A=[[int(i)-1 for i in input().split()] for _ in range(m)]

ans = [0]*(m+1)
a = n*(n-1)//2
ans[0] = a

uf = UnionFind(n)
for i in range(m):
    j = m-i-1
    v1 = A[j][0]
    v2 = A[j][1]
#    print(v1,v2)
    if not uf.issame(v1,v2):
#        print(uf.parent)
        a -= uf.size(v1) * uf.size(v2)
        uf.merge(v1,v2)

    ans[i+1]=a

for i in range(m):
    print(ans[m-i-1])
    
    
    
    
    
    





Measured memory_bytes: 27192
while n = gets.to_i
  break if n == 0
  arr = gets.split(' ').map(&:to_i)

  0.upto(arr.size - 1) do |i|
    v = arr[i]
    j = i - 1
    while j >= 0 && arr[j] > v
      arr[j+1] = arr[j]
      j -= 1
    end
    arr[j+1] = v
    puts arr.join(' ')
  end
end

Measured memory_bytes: 8708
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
const ll maxn=2e5+111;
ll a[maxn];
map<ll,ll> mp1,mp2;
int main(){
    ll n;
    scanf("%lld",&n);
    for(ll i=1;i<=n;++i){
        scanf("%lld",a+i);
        mp1[i+a[i]]++;
        mp2[i-a[i]]++;
    }
    ll ans=0;
    for(auto w:mp1){
        ans+=w.second*mp2[w.first];
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 39620
#include<bits/stdc++.h>
#define N 300
using namespace std;
typedef complex<double> P;
const double EPS = 1e-5;

struct Circle{
  P c;
  double r;
  Circle(P c=P(0,0),double r=0):c(c),r(r){}
};

vector<P> getIntersectCC(Circle c1, Circle c2){
  vector<P> res;
  double r1=c1.r,r2=c2.r,d;
  P p1=c1.c,p2=c2.c;
  d=abs(p1-p2);
  if(d<EPS&&abs(r1-r2)<EPS) return res;
  if(r1+r2<d-EPS||d+EPS<abs(r1-r2)) return res; 
  double a=(r1*r1-r2*r2+d*d)/(2*d);
  double h=sqrt(max(r1*r1-a*a,0.0));
  P tmp1=p1+a/d*(p2-p1);
  P tmp2=h/d*(p2-p1);
  if(abs(tmp2)<EPS)res.push_back(tmp1);
  else{
    res.push_back(P(real(tmp1)-imag(tmp2),imag(tmp1)+real(tmp2)));
    res.push_back(P(real(tmp1)+imag(tmp2),imag(tmp1)-real(tmp2)));
  }
  return res;
}

double getdistancepp(P a,P b){
  return sqrt((a.real()-b.real())*(a.real()-b.real())+(a.imag()-b.imag())*(a.imag()-b.imag()));
}

int main(){
  int n,ans;
  double a,b;
  P p[N];
  while(1){
    ans=0;
    cin>>n;
    if(!n)break;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      p[i]=P(a,b);
    }
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	Circle c1,c2;
	c1.c=p[i];
	c2.c=p[j];
	c1.r=c2.r=1;
	vector<P> r=getIntersectCC(c1,c2);
	if(!r.size())continue;
	for(int k=0;k<r.size();k++){
	  int cnt=0;
	  for(int l=0;l<n;l++)
	    if(getdistancepp(r[k],p[l])<=1+EPS)cnt++;	    
	  ans=max(ans,cnt);
	}
      }
    }
    if(!ans&&n>=1)ans=1;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1252
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//228
	int n;
	cin>>n;
	ll sum = 0;
	int mx= 0;
	REP(i,1,n){
		int val;
		cin>>val;
		sum+=val;
		mx=max(mx,val);
	}
	sum-=mx/2;
	cout<<sum;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <cmath>
 
using namespace std;
 
int main(){
  int w, h, n;
  cin >> w >> h >> n;
  int xmin = 0;
  int xmax = w;
  int ymin = 0;
  int ymax = h;
  
  for(int i = 0; i < n; i++){
    int xi, yi, ai;
    cin >> xi >> yi >> ai;
    
    if(ai == 1) xmin = max(xmin, xi);
    else if(ai == 2) xmax = min(xmax, xi);
    else if(ai == 3) ymin = max(ymin, yi);
    else ymax = min(ymax, yi);
  }
  
  if(xmax <= xmin || ymax <= ymin) cout << 0 << endl;
  else cout << (xmax - xmin) * (ymax - ymin) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int l = 1;
	while (true) {
		int x; cin >> x;
		if (!x)return 0;
		cout << "Case " << l++ << ": " << x << endl;
	}
	int e; cin >> e;
}


Measured memory_bytes: 3000
x = gets.chomp
ss = 0
tt = 0
st = 0
x.each_char do |c|
  if c == "S" then
    ss += 1
  else
    tt += 1
    if ss != 0 then
      st += 1
      ss -= 1
    end
  end
end
puts tt * 2 - st * 2


Measured memory_bytes: 2172
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int dayn,clothn;
    int dayC[200],clothI[3][200];
    int DP[200][200]={0};
    int sum,ans=0;
    scanf("%d%d",&dayn,&clothn);
    for(int i=0;i<dayn;i++)
        scanf("%d",&dayC[i]);
    for(int i=0;i<clothn;i++){
        for(int j=0;j<3;j++)
            scanf("%d",&clothI[j][i]);
    }
    for(int i=1;i<dayn;i++){
        for(int j=0;j<clothn;j++){
            for(int k=0;k<clothn;k++){

                /*
                for(int di=0;di<dayn;di++){
                    for(int dj=0;dj<clothn;dj++){
                        printf("%d ",DP[di][dj]);
                    }
                    puts("");
                }
                puts("-------");
                */

                if(clothI[0][j]<=dayC[i]&&dayC[i]<=clothI[1][j]&&clothI[0][k]<=dayC[i-1]&&dayC[i-1]<=clothI[1][k]){
                    sum=clothI[2][k]-clothI[2][j];
                    if(sum<0)
                        sum*=-1;
                    DP[i][j]=max(DP[i][j],DP[i-1][k]+sum);
                }
            }
        }
    }
    for(int i=0;i<clothn;i++){
        ans=max(ans,DP[dayn-1][i]);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1356
from itertools import accumulate

N = int(input())
A1 = [int(x) for x in input().split()]
A2 = [int(x) for x in input().split()]

B1 = list(accumulate(A1))
B2 = [0] + list(accumulate(A2))

ans = 0
for i in range(N):
    candies = B1[i] + (B2[-1] - B2[i])
    ans = max(ans, candies)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define re return
#define pb push_back
#define po pop_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define si size
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define pi 3.14159265359
#define er erase
#define in insert
#define em empty
#define ft front
#define fo(i,n) for(i = 0; i < n; i++)
#define ro(i,n) for(i = n - 1; i >= 0; i--)
#define fr(i,j,n) for(i = j; i < n; i++)
#define rf(i,j,n) for(i=n-1;i>=j;i--)
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::pair<int,int> ii;
typedef std::vector<ii> vii;
typedef std::vector<std::string> vs;
typedef double dl;
typedef long double ld;
typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> vll;
#define filename ""
using namespace std;
    int a[(int)2e5+10];
    int b[(int)2e5+10];
int main()
{
    /*
	freopen(filename".in","r",stdin);
	freopen(filename".out","w",stdout);
	*/
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    */
    /*
    ios::sync_with_stdio(0);
    */
    int n;
    cin>>n;
    int i;
    fo(i,n)
    {
        scanf("%d",&a[i]);
    }
    fo(i,n)
    {
        b[a[i]]=b[a[i]-1]+1;
    }
    int o=0;
    fo(i,n+1)
    {
        o=max(o,b[i]);
    }
    cout<<n-o;
}


Measured memory_bytes: 1792
n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
conn = dict()
for i in range(n):
    conn[i] = []

for i in range(m):
    a, b = [int(i) for i in input().split()]
    a -= 1
    b -= 1
    conn[a].append(h[b])
    conn[b].append(h[a])

sumer = 0
for i in range(n):
    if conn[i] == []:
        sumer += 1
    elif h[i] > max(conn[i]):
        sumer += 1

print(sumer)

Measured memory_bytes: 94484
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;
    
    while(1) {
        int i;
        i = (int)S.find("A");
        if(i == -1) break;
        S.replace(i, 1, "*");
    }
    while(1) {
        int i;
        i = (int)S.find("C");
        if(i == -1) break;
        S.replace(i, 1, "*");
    }
    while(1) {
        int i;
        i = (int)S.find("G");
        if(i == -1) break;
        S.replace(i, 1, "*");
    }
    while(1) {
        int i;
        i = (int)S.find("T");
        if(i == -1) break;
        S.replace(i, 1, "*");
    }
    
    int L=0;
    string T="*";
    while(1) {
        int j;
        j = (int)S.find(T);
        if(j == -1) break;
        else {
            L++;
            T+="*";
        }
    }
    
    cout << L << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool is_prime(int n){
	if(n <= 1) return false;
	if(n == 2) return true;
	if(n % 2 == 0) return false;
	for(int i = 3; i * i <= n; i++){
		if(n % i == 0) return false;
	}
	return true;
}
int main(){
	int n;
	vector<int> prime_numbers;
	for(int i = 1; i < 10000; i++){
		if(is_prime(i)) prime_numbers.push_back(i);
	}
	vector<ll> cumulative_sum;
	ll sum = 0;
	for(int i = 0; i < prime_numbers.size(); i++){
		cumulative_sum.push_back(sum);
		sum += prime_numbers[i];
	}
	cumulative_sum.push_back(sum);
	for(;;){
		cin >> n;
		if(n == 0) break;
		int ans = 0;
		for(int i = 0; i < cumulative_sum.size(); i++){
			for(int j = 0; j <= i; j++){
				if(cumulative_sum[i] - cumulative_sum[j] == n) ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3128
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll pow (ll x, ll n){
    ll ans = 1;
    while(n>0){
        if(n & 1 == 1){
            ans *= x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

int main(){
    int n,l ;   cin >> n >> l;
    string s[120];
    rep(i,n)    cin >> s[i];
    sort(s, s + n);
    string S;
    rep(i,n){
        S += s[i];
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1,0,-1):
    if H[i-1] - H[i] > 1:
        print("No")
        exit()
    if H[i-1] - H[i] == 1:
        H[i-1] -= 1

for i in range(N-1):
    if H[i] > H[i+1]:
        print("No1")
        exit()
        
print("Yes")

Measured memory_bytes: 20676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

}

Measured memory_bytes: 38336
#include <iostream>

using namespace std;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	bool flag = false;

	for(int i=0;i < 1000000;i ++)
	{
		if((a * i) % b == c)
		{
			flag = true;
			break;
		}
	}
	
	cout << (flag ? "YES" : "NO") << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int W = sc.nextInt();
    int[][] weightAndValues = new int[N][2];
    for (int i = 0; i < N; i++) {
      weightAndValues[i][0] = sc.nextInt();
      weightAndValues[i][1] = sc.nextInt();
    }
    long ans = solve(weightAndValues, N, W);
    System.out.println(ans);
  }

  private static long solve(int[][] weightAndValues, int n, int w) {
    int V = 0;
    for (int i = 0; i < n; i++) {
      V += weightAndValues[i][1];
    }
    long[] dp = new long[V + 1];
    for (int i = 0; i < V + 1; i++) {
      dp[i] = Integer.MAX_VALUE;
    }
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = V - weightAndValues[i][1]; j >= 0; --j) {
        dp[j + weightAndValues[i][1]] =
            Math.min(weightAndValues[i][0] + dp[j], dp[j + weightAndValues[i][1]]);
      }
    }
    long max = Integer.MIN_VALUE;
    for (int i = V; i >= 0; i--) {
      if (dp[i] <= w) {
        max = i;
        break;
      }
    }
    return max;
  }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e6+9;
ll a[N];
ll cnt[89];
ll ans;
const int mod=1e9+7;
int n;
int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    for(int j=0;j<60;j++)if((a[i]>>j)&1)cnt[j]++;
  }
  for(int i=0;i<60;i++)ans=(ans+(1ll<<i)%mod*cnt[i]%mod*(n-cnt[i])%mod)%mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <math.h>

typedef struct {
	double x;
	double y;
} pnt;

void printp(pnt *);
void koch(int, pnt *, pnt *);

int main(void)
{
	int n;
	pnt p1, p2;
	
	scanf("%d",&n);
	p1.x = 0;
	p1.y = 0;
	p2.x = 100;
	p2.y = 0;
	printp(&p1);
	koch(n, &p1, &p2);
	printp(&p2);
	
	return 0;
}

void printp(pnt *p)
{
	printf("%f %f\n", p->x, p->y);
}

void koch(int n, pnt *p1, pnt *p2)
{
	pnt s, t, u;
	
	if(n==0) return;
	
	s.x = (2*p1->x + p2->x) / 3;
	s.y = (2*p1->y + p2->y) / 3;
	t.x = (p1->x + 2*p2->x) / 3;
	t.y = (p1->y + 2*p2->y) / 3;
	u.x = ( (t.x - s.x) - (t.y - s.y)*sqrt(3) ) / 2 + s.x;
	u.y = ( (t.x - s.x)*sqrt(3) + (t.y - s.y) ) / 2 + s.y;
	
	koch(n-1, p1, &s);
	printp(&s);
	koch(n-1, &s, &u);
	printp(&u);
	koch(n-1, &u, &t);
	printp(&t);
	koch(n-1, &t, p2);
}

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

using namespace std;

int main()
{

  int N;
  cin >> N;
  vector<int> H(N);

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

  for (int i = N - 2; i >= 0; --i) {
    if (H[i] == (H[i + 1] + 1)) {
      H[i]--;
    }
    else if (H[i] > (H[i + 1] + 1)) {
      cout << "No";
      return 0;
    }
  }

  for (int i = 0; i < N - 1; i++) {
    if (H[i] > H[i + 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

int main2()
{

  int N;
  cin >> N;
  vector<int> H(N);

  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  //! �����̉E���̗v�f��2�ȏ㏬�����̂����邩���ׂ�
  for (int i = 0; i < N - 1; i++) {
    int h = H[i];
    int h_min = *min_element(H.begin() + i + 1, H.end());
    if (h - h_min >= 2) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

int main1()
{

  int N;
  cin >> N;
  vector<int> H(N);

  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  /*
  for (int i = 0; i < N; i++) {
    cerr << H[i] << " ";
  }
  cerr << endl;
  */
  for (int i = 0; i < N-1; i++) {
    if (H[i] > H[i + 1]) {
      H[i]--;
    }
  }
  /*
  for (int i = 0; i < N; i++) {
    cerr << H[i] << " ";
  }
  cerr << endl;
  */

  for (int i = 0; i < N - 1; i++) {
    if (H[i] > H[i + 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";

  return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int month,day;
    
    while(1){
        scanf("%d %d",&month,&day);
        if(month==0)break;
        
        switch(month){
            case 12 :day+=30;
            case 11 :day+=31;
            case 10 :day+=30;
            case 9  :day+=31;
            case 8  :day+=31;
            case 7  :day+=30;
            case 6  :day+=31;
            case 5  :day+=30;
            case 4  :day+=31;
            case 3  :day+=29;
            case 2  :day+=31;
            case 1  :break;
        }
        
        switch(day%7){
            case 0 :puts("Wednesday");break;
            case 1 :puts("Thursday");break;
            case 2 :puts("Friday");break;
            case 3 :puts("Saturday");break;
            case 4 :puts("Sunday");break;
            case 5 :puts("Monday");break;
            case 6 :puts("Tuesday");break;
        }
    }
    
    return 0;
}

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

//~ const int MOD=1000000007;
const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	ll a;string s;cin>>a>>s;
	string t;
	for(char c:s){
		if(c!='.')t+=c;
	}
	ll b=stoi(t);
	cout<<a*b/100<<endl;
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

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

int H, W;
char S[2123][2123];
int l[2123][2123], r[2123][2123], u[2123][2123], d[2123][2123];

int main() {

	scanf("%d%d", &H, &W);
	rep(i, H) scanf("%s", S[i]);

	rep(i, H) rep(j, W - 1) {
		if (S[i][j + 1] == '.') {
			l[i][j + 1] = l[i][j] + (S[i][j] == '.' ? 1 : 0);
		}
	}
	rep(i, H) rep(j, W - 1) {
		if (S[i][W - j - 2] == '.') {
			r[i][W - j - 2] = r[i][W - j - 1] + (S[i][W - j - 1] == '.' ? 1 : 0);
		}
	}
	rep(j, W) rep(i, H - 1) {
		if (S[i + 1][j] == '.') {
			u[i + 1][j] = u[i][j] + (S[i][j] == '.' ? 1 : 0);
		}
	}
	rep(j, W) rep(i, H - 1) {
		if (S[H - i - 2][j] == '.') {
			d[H - i - 2][j] = d[H - i - 1][j] + (S[H - i - 1][j] == '.' ? 1 : 0);
		}
	}

	int ans = 0;

	rep(i, H) rep(j, W) {
		if (S[i][j] == '.') {
			ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1);
		}
	}

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

	return 0;
}


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

const int MAXN=100000+10;
int h[MAXN],dp[MAXN];

int main(){
	memset(dp,0,sizeof(dp));
	int n; 
	cin>>n;
	for(int i=0;i<n;++i)
		cin>>h[i];
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;++i)
		dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
P = list(map(float,input().split()))

dp = [[0]*(i+1) for i in range(N+1)]
dp[0][0] = 1.0

for i,p in enumerate(P):
    for j in range(i+1):
        dp[i+1][j] += dp[i][j] * (1-p)
        dp[i+1][j+1] += dp[i][j] * p
print(sum(dp[-1][N//2+1:]))

Measured memory_bytes: 148232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x=c-a,y=d-b;
  cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x<<endl;
}

Measured memory_bytes: 3572
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]
    count = 0
    current = 1
    for x in a:
        if x == current:
            current += 1
        else:
            count += 1
    if count == N:
        print(-1)
    else:
        print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 26140
#include <stdio.h>
 
int main() 
{
  int h, w, n, hasil;
  scanf("%d %d %d", &h, &w, &n);
  hasil = (h > w) ? (n + h-1)/h : (n + w-1)/w;
  printf("%d\n", hasil);
  
  return 0;
}


Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

int n;
string s;

int f(string s) {
	int n = s.size(), l = -1, r = -1;
	vi p(n);

	for(int i=1; i<n; ++i) {
		if(i <= r) 
			p[i] = min(r-i, p[i-l]);
		while (i+p[i]<n && s[i+p[i]] == s[p[i]]) p[i]++;
		if (r < i+p[i]) r = i+p[i], l = i;
	}

	int ret = 0;
	rep(i,1,n) {
		ret = max(ret, min(i,p[i]));
	}
	return ret;
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	scanf("%d", &n);
	char buff[5001];
	scanf("%s", buff);
	s = string(buff);
	int ret = 0;
	rep(i,0,n) {
		//cout << f(s.substr(i)) << endl;
		ret = max(ret, f(s.substr(i)));
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
c = []
d = []
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d.append(list(input()))
for i in range(a - b + 1):
    for j in range(a - b + 1):
        e = True
        for k in range(i, i + b):
            for l in range(j, j + b):
                if c[k][l] != d[k-i][l-j] and e:
                    e = not e
        if e:
            print("Yes")
            exit()
print("No")


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

typedef long long ll;
ll N;

int main() {
  // 入力
  cin >> N;
  // Nのルートまで繰り返し、答えを求める
  int ans = 100;  // 最小の桁数を求めるので、10桁よりも大きい数値ならなんでもOK
  for (int i=1; i<=sqrt(N); i++) {
    if (N % i != 0) continue;
    string n1 = to_string(i);
    string n2 = to_string(N/i);
    ans = min(ans, max((int)n1.size(), (int)n2.size()));
  }
  // 解答
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

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


	vector<long long int> A(N);
	vector<pair<long long int, int>> ch(M);

	int i, b;
    long long int c;
 	for (i = 0; i < N; i++) {
		cin >> A.at(i);
	}

	for (i = 0; i < M; i++) {
		cin >> b >> c;
		ch[i] = make_pair(c, b);
	}

	sort(A.begin(), A.end());
	sort(ch.begin(), ch.end());

	int count = 0, cou = M - 1;
	
	while(count < N && cou >= 0) {
		for (int k = 0; k < ch[cou].second ; k++) {
			if (A[count] < ch[cou].first) {
				A[count] = ch[cou].first;
				count++;
			}
			else {
				break;
			}
		}
		cou--;
	}

	long long int ans = 0;
	for (i = 0; i < N; i++) {
		ans += A[i];
	}

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

Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef std::pair<ll, ll> PLL;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT

using namespace std;

signed main() {
  ll N, K, S;
  cin >> N >> K >> S;
  vector<ll> a(N);
  rep(i, N) {
    if (i < K) {
      a[i] = S;
    } else if (S <= 2) {
      a[i] = 1000;
    } else {
      a[i] = S-1;
    }
  }
  rep(i, N) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
n,m,x,y = map(int,input().split())

xl = list(map(int,input().split()))
yl = list(map(int,input().split()))

ans = 'War'

for i in range(x + 1 ,y + 1):
    if max(xl) < i <= min(yl):
        ans = 'No War'
        break

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  char a,b;
  cin >> a>>b;
 
  cout << ((a=='9' || b=='9')? "Yes":"No") << endl;
  
}



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

int main(){
    string S,T;
    cin >> S >> T;
    int len = S.size();
    string ans = "No";
    string letter = "";
    string copied = S + S;
    for (int i = 0; i <= len; i++){
        for (int j = 0; j < len; j++){
            letter += copied.at(i + j);
        }
        if (letter == T){
            ans = "Yes";
        }
        letter = "";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i, l, r) for(int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define f(i, r, l) for(int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define file(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
using namespace std;

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

inline int read() {
 int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}
const int mod=1e9+7;
int n,m;
struct node{
   int u,v;
}p[100005];
int dp[1<<16],g[1<<16],P[1<<16];
int main () {
#ifndef ONLINE_JUDGE
//file("at2390");
#endif
     n=read();
	 m=read();
	 F(i,1,m){
	   p[i].u=read();
	   p[i].v=read();
	    g[p[i].u]|=1<<(p[i].v-1);
	 }
	 dp[0]=1;
	 P[0]=1;
	 F(i,1,m){
	    P[i]=2ll*P[i-1]%mod;
	 }
	 F(s,1,(1<<n)-1){
	    if((s&1)==(s>>1&1)){
		for(int nxt=s;nxt;nxt=(nxt-1)&s){
		   if((nxt&1)==(nxt>>1&1)){
			   int cnt=1;
			   F(i,1,n){
			      if((s>>(i-1))&1){
				     if((nxt>>(i-1))&1){
					   cnt=(1ll*cnt*P[__builtin_popcount(g[i]&(s^nxt))]%mod);  
					 }
				   else cnt=1ll*cnt*(P[__builtin_popcount(g[i]&nxt)]-1)%mod;
				  }
			  }
		      dp[s]=(dp[s]+1ll*dp[s^nxt]*cnt%mod)%mod;
		   }
		}
	  }
	 }
	 printf("%d\n",(P[m]-dp[(1<<n)-1]+mod)%mod);
    return 0;
}

Measured memory_bytes: 384
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int solve(string s, char c){
    int len = s.size();
    for(int i = 0; i < len; i++){
        bool ok = true;
        for(int j = 0; j < len - i; j++){
            if(s[j] != c){
                ok = false;
            }
        }
        if(ok){
            return i;
        }
        for(int j = 0; j < len; j++){
            s[j] = s[j] == c ? c : s[j + 1];
        }
    }
    return M;
}

int main(){
    string s; cin >> s;
    int ans = M;
    for(char c = 'a'; c <= 'z'; c++){
        ans = min(ans, solve(s, c));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#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 rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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


    ll ans = 0;
    rep(i,100000){
        if(i*(i+1)/2>=n){
            ans = i;
            break;
        }
    }
    
    drep(i,ans+1){
        if(n>=i){
            cout << i << endl;
            n -= i;
        }
        if(n==0)break;
    }
    return 0;
}
 
 


Measured memory_bytes: 256
a, b=list(map(int,input().split()))

count=0
for n in range(a,b+1):
    s = str(n)
    array = list(map(int, s))

    if array[0]==array[-1]:
        if array[1]==array[-2]:
            if array[2]==array[-3]:
                count+=1

print(count)


Measured memory_bytes: 3060
def main():
    n = int(input())
    
    tmp = ""
    f = True
    st = []
    for i in range(n):
        w = input()
        st.append(w)
        if i > 0:
            if tmp[-1] == w[0]:
                pass
            else:
                f = False
        tmp = w
    if len(list(set(st))) != n:
        f = False
    
    print("Yes" if f else "No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim().Replace("-", "");
            var train = s.Substring(0, 1);
            for (int j = 1; j < s.Length; j += 2)
            {
                var cmd = s.Substring(j, 2);
                var x = train.IndexOf(cmd[1].ToString());
                if (x < 0 && cmd[0] == '>') train += cmd[1].ToString();
                if (x < 0 && cmd[0] == '<') train = cmd[1].ToString() + train;
            }
            Console.WriteLine(train);
        }
    }
}

Measured memory_bytes: 9968
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, a[100010];

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    int ans = 0;
    rep(i, n) {
        if (a[a[i]-1] == i+1) ans++;
    }
    cout << ans/2 << endl;
}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

const int N = 10;
ll p [15];
bool A [2] [N + 1];

bool query(string str)
{
	printf("? %s\n",str.c_str());
	fflush(stdout);
	char res [17];
	scanf("%s",res);
	return res [0] == 'Y';
}

int main()
{
	p [0] = 1;
	FOR(i,1,15){
		p [i] = p [i - 1] * 10;
	}
	ll d = 1;
	for(int i = N;i >= 1;i--){
		A [0] [i] = query(to_string(p [i - 1]));
		A [1] [i] = query(to_string(p [i] - 1));
		if(i + 1 <= N && (A [0] [i] != A [0] [i + 1] || A [1] [i] != A [1] [i + 1])){
			if(A [0] [i] && A [1] [i]){
				d = i;
			}
			else{
				d = i + 1;
			}
			break;
		}
	}

	ll lo = p [d] - 1,hi = p [d + 1] - 1,mid;
	while(hi - lo > 1){
		mid = (lo + hi) / 2;
		if(query(to_string(mid))){
			hi = mid;
		}
		else{
			lo = mid;
		}
	}

	printf("! %lld\n",hi / 10);
	fflush(stdout);

	return 0;
}


Measured memory_bytes: 596
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,K;
    scanf("%d %d",&N,&K);
    long long int A;
    A=K;
    for (int i=1;i<N;i++){
        A=A*(K-1);
    }
    cout<<A<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int numx[101];
int numy[101];

int main()
{
    int num;
    double result_1 = 0.0;
    double result_2 = 0.0;
    double result_3 = 0.0;
    double result_4 = 0.0;
    
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> numx[i];
    }
    
    for (int i = 0; i < num; i++)
    {
        cin >> numy[i];
    }
    
    for (int i = 0; i < num; i++)
    {
        result_1 += fabs(numx[i] - numy[i]);
        result_2 += pow((numx[i] - numy[i]), 2.0);
        result_3 += pow(fabs(numx[i] - numy[i]), 3.0);
        if (fabs(numx[i] - numy[i]) > result_4)
        {
            result_4 = fabs(numx[i] - numy[i]);
        }
    }
    
    cout << setprecision(20) << result_1 << endl;
    cout << setprecision(20) << sqrt(result_2) << endl;
    cout << setprecision(20) << pow(result_3, 1.0 / 3.0) << endl;
    cout << setprecision(20) << result_4 << endl;

    return 0;
}



Measured memory_bytes: 3472
#include <iostream>
#include <string.h>
#include <climits>
using namespace std;




int main(){
  // INPUT
  int n;
  cin >> n;
  int a[n+2];
  long long sum = 0;
  int count = 0;
  int intmin = INT_MAX;
  int minI = 0;
  a[0] = 0; a[n+1] = 0;
  for(int i=1;i<=n;i++){
    cin >> a[i];
    if(a[i]>0){sum = sum + a[i];}
    else{
      sum = sum - a[i];
      //cout << sum << endl;
      count++;
    }
    if (intmin > abs(a[i]) ){
      minI= i;
      intmin = abs(a[i]);
    }
  }

  // CALC
  if(count%2 == 0){
    cout << sum << endl;
  }else{
    cout << sum - abs(2*intmin) << endl;
  }






  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"
//----------------------------------------------------------------

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

  priority_queue<ll, vector<ll>, greater<ll>> q, r;
  q.push(3);
  q.push(5);
  q.push(7);
  r.push(3);
  r.push(5);
  r.push(7);

  while(r.size()<60000){
    ll tmp = q.top();
    q.push(tmp*10+3);
    q.push(tmp*10+5);
    q.push(tmp*10+7);
    r.push(tmp*10+3);
    r.push(tmp*10+5);
    r.push(tmp*10+7);
    q.pop();
  }

  int ans = 0;

  while(r.top()<=n){
    string s = to_string(r.top());
    r.pop();
    bool is_3=false, is_5=false, is_7=false;
    rep(i,s.size()){
      if(s[i]=='3') is_3=true;
      if(s[i]=='5') is_5=true;
      if(s[i]=='7') is_7=true;
    }
    if(is_3 && is_5 && is_7) ans++;

  }

  prt(ans);
}


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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define list_input(x, n) x[n]; rep(i,n){ cin >> x[i];}
#define ll long long

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a-c) <= d || ( abs(a-b) <= d && abs(b-c) <= d ) ) {
    cout << "Yes" << "\n";
  }else{
    cout << "No" << "\n";
  }
}


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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define forr(i,a,b) for(ll i=(a);i<=(b);i++)
#define ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define size(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)



int main(void) {
    long int N,i,j;
    cin >> N;
    long int n[2000002];
    long int m[2000002];
    for(i=0;i<N-1;++i){
       cin >> n[i];
      
    }
     for(i=0;i<N-1;++i){
     
       m[n[i]-1]++;
    }
    for (j=0;j<N;++j){
        
         cout << m[j] << "\n";
    

    }   
    
  return 0;
}

Measured memory_bytes: 6780
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll a, b;
  cin >> a >> b;
  ll xx = ((1ll^2ll)^(3ll));
  cout << ((xx^a)^b) << endl;
  return 0;
} //good night.

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

#define pb push_back
#define fi first
#define SZ(x) (int((x).size()))
#define se second
#define ll long long
#define pq priority_queue
#define MP make_pair
#define pii pair<int,int>
#define mod 998244353
#define debug(x) cerr<<#x<<"="<<x<<'\n'

const int maxn=1e6+10;

int n;
map <ll,int> mp;
ll D[maxn];
pair<ll,int> d[maxn];
int sz[maxn];
ll f[maxn];
vector <int> e[maxn];

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		ll x;
		scanf("%lld",&x);
		d[i]=MP(x,i);
		mp[x]=i;
		D[i]=x;
	}
	sort(d+1,d+n+1);
	reverse(d+1,d+n+1);
	memset(sz,0,sizeof(sz));
	memset(f,0,sizeof(f));
	for (int i=1;i<n;i++) {
		sz[d[i].se]++;
		if (n-2*sz[i]<=0) {
			puts("-1");
			return 0;
		}
		ll want=d[i].fi-(ll)(n-2*sz[d[i].se]);
		if (mp.find(want)==mp.end()) {
			puts("-1");
			return 0;
		}
		e[d[i].se].pb(mp[want]);
		e[mp[want]].pb(d[i].se);
		sz[mp[want]]+=sz[d[i].se];
		f[mp[want]]+=(ll)sz[d[i].se]+f[d[i].se];
	}
	if (f[d[n].se]!=D[d[n].se]) {
		puts("-1");
		return 0;
	}
	for (int i=1;i<=n;i++)
		for (int j=0;j<e[i].size();j++) {
			if (e[i][j]>i) printf("%d %d\n",i,e[i][j]);
		}
	return 0;
}


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

int main() {
  string a;
  cin>>a;
  int b=0;
  int c=0;
  if(a.size()%2==1){
    b++;
  }
  else{
    for(int i=0;i<a.size()/2;i++){
      if(!(a.at(i*2)=='h'&&a.at(i*2+1)=='i')){
        b++;
      }
    }
  }
  if(b==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#include<cstdlib>
#include <queue>
#include <cmath>
#include <iomanip>
#include<list>
#include <utility>
#include <functional>
#include <tuple>
#define T long long

bool have[100]={false};

int main(){
	int n,k;
	std::cin >> n>>k;
	for(int i=0;i<k;i++){
		int d;
		std::cin >> d;
		for(int j=0;j<d;j++){
			int a;
			std::cin >>a;
			have[a-1]=true;
		}
	}
	int result = 0;
	for(int i=0;i<n;i++){
		if(!have[i]){
			result ++;
		}
	}
	std::cout << result << std::endl;
}


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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int a[3];

int main() {
  // 入力
  for (int i = 0; i < 3; i++) cin >> a[i];

  sort(a, a + 3);
  int d1 = a[2] - a[0];
  int d2 = a[2] - a[1];

  int ans = 0;
  if (!(d1 & 1) && !(d2 & 1)) {
    ans = d1 / 2 + d2 / 2;
  } else if (d1 & 1 && d2 & 1) {
    ans = (d1 + d2) / 2;
  } else {
    ans = (d1 + d2 + 1) / 2 + 1;
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

typedef long long ll;

int main() {
    ll N;
    ll ans = 0;
    cin >> N;
    for (ll i = 2; i*i <= N; i++) {
        if (N % i != 0) continue;
        ll z = i;
        while (N%z==0) {
            N/= z;
            z *= i;
            ans++;
        }
        while (N % i == 0) {
            N/= i;
        }
    }
    if (N != 1) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3632
//https://atcoder.jp/contests/abc106/tasks/abc106_c

import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;



int main()
{
    int N,X;
    cin >> N >> X;
    vector<int> m(N);

    int minDonut = 1001;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        /* code */
        cin >> m[i];
         X -= m[i];
        minDonut = min(minDonut,m[i]);
        ans++;
    }

    ans += X / minDonut;
    cout << ans << endl;
  

}

Measured memory_bytes: 256