akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;


class Pair<E,F>{
    E first;
    F second;
    public Pair(E first, F second){
        this.first=first;
        this.second=second;
    }
    public E getFirst(){return first;}
    public F getSecond(){return second;}
    public String toString(){
        return "<"+first.toString()+","+second.toString()+">";
    }
    public int hashCode(){
        return first.hashCode()*30011+second.hashCode()+2;
    }
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Pair another = (Pair) obj;
        return this.getFirst().equals(another.getFirst())&&this.getSecond().equals(another.getSecond());
    }
}
class Point extends Pair<Double,Double>{
    public Point(double x, double y){
        super(x,y);
    }
    public double distanceTo(Point another){
        double distX = Math.abs(this.getFirst()-another.getFirst());
        double distY = Math.abs(this.getSecond()-another.getSecond());
        return Math.sqrt(distX*distX+distY*distY);/*euclidean dist*/
    }
}


public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Point[] p = new Point[N];
        for(int n=0; n<N; n++) p[n] = new Point(sc.nextInt(), sc.nextInt());

        double ans = 10000;

        for(int i=0; i<N; i++) for(int j=i+1; j<N; j++){
            Point middle = new Point((p[i].first+p[j].first)/2, (p[i].second+p[j].second)/2);
            double radius = 0;
            for(int l=0; l<N; l++){
                radius = Math.max(radius, middle.distanceTo(p[l]));
            }
            ans = Math.min(ans, radius);
        }

        for(int i=0; i<N; i++) for(int j=i+1; j<N; j++) for(int k=j+1; k<N; k++){
            double a = p[i].first, b = p[i].second;
            double c = p[j].first, d = p[j].second;
            double e = p[k].first, f = p[k].second;
            Point circum;


            double S = Math.abs(((a-e)*(d-f)-(c-e)*(b-f))/2);
            if(S<1e-9) circum = new Point((Math.max(Math.max(a,c), e)+Math.min(Math.min(a,c), e))/2,
                                          (Math.max(Math.max(b,d), f)+Math.min(Math.min(b,d), f))/2);
            else{
                double x = p[j].distanceTo(p[k]);
                double y = p[k].distanceTo(p[i]);
                double z = p[i].distanceTo(p[j]);
                circum = new Point( (x*x*(y*y+z*z-x*x)*a + y*y*(z*z+x*x-y*y)*c + z*z*(x*x+y*y-z*z)*e)/(16*S*S),
                                    (x*x*(y*y+z*z-x*x)*b + y*y*(z*z+x*x-y*y)*d + z*z*(x*x+y*y-z*z)*f)/(16*S*S));
            }
            double radius = 0;
            for(int l=0; l<N; l++){
                radius = Math.max(radius, circum.distanceTo(p[l]));
            }
            ans = Math.min(ans, radius);
        }


        System.out.println(ans);
    }


}


Measured memory_bytes: 26396
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,m,x,y;
	cin>>n>>m>>x>>y;
	vector<ll>  v1(n,0),v2(m,0);
	for(ll i=0;i<n;i++) cin>>v1[i];
	for(ll i=0;i<m;i++) cin>>v2[i];
	
	bool bb=1;
	ll maxi=INT_MIN,mini=INT_MAX;
	for(ll i=0;i<n;i++) maxi=max(maxi,v1[i]);
	for(ll i=0;i<m;i++) mini=min(mini,v2[i]);
	for(ll i=maxi;i<=mini;i++){
		if(x<i&&i<=y&&i>maxi&&i<=mini){
			bb=0;
		}
	}
	
	if(bb==1) cout<<"War";
	else cout<<"No War";
}

Measured memory_bytes: 3640
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << x << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

lint gcd(lint x, lint y){
    if(x < y){
        lint tmp = x;
        x = y;
        y = tmp;
    }

    lint r = x % y;
    while(r != 0){
        x = y;
        y = r;
        r = x % y;
    }

    return y;
}

lint lcm(lint x, lint y){
    lint tmp = gcd(x, y);
    return x / tmp * y;
}

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

    int n;
    cin >> n;
    vector<lint> t(n);
    for(int i=0; i<n; i++) cin >> t[i];

    for(int i=1; i<n; i++){
        t[i] = lcm(t[i-1], t[i]);
    }
    COUT(t.back());

    return 0;
}

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

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<int>> field(H,vector<int>(W));
  vector<vector<bool>> visited(H, vector<bool>(W,false));
  //vector<vector<int>> ansF(H,vector<int>(W));
  int white = 0;

  rep(i,H){
    rep(j,W){
      char s;
      cin >> s;
      if(s == '.') field[i][j] = 0, white++;
      else field[i][j] = 1 , visited[i][j] = true;
    }
  }

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

  queue<tuple<int,int,int>> que;
  que.push(make_tuple(0,0,0));
  visited[0][0] = true;

  while(!que.empty()){
    auto p = que.front();que.pop();
    int x = get<0>(p);
    int y = get<1>(p);
    int count = get<2>(p);

    rep(i,4){
      int nX = x + dx[i];
      int nY = y + dy[i];
      if(nX >=0 && nX < H && nY >= 0 && nY < W){
        if(!visited[nX][nY] && (field[nX][nY] == 0)){
          field[nX][nY] = count + 1;
          visited[nX][nY] = true;
          que.push(make_tuple(nX,nY,count+1));
        }
      }
    }
  }
  if(visited[H-1][W-1]){
    cout << white-field[H-1][W-1]-1;
  }else{
    cout << -1;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1777777777;
const ll INF=1000000000;
const ll LINF=4000000000000000010;
vector<ll> v,v2;
int main(){
	int n;cin>>n;
	ll a[100010];
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)v.push_back(a[i]);
	sort(all(v),greater<ll>());
	ll ans=0;
	if(n%2){
	for(int i=0;i<n/2;i++){
		ans+=v[i]*2LL;
	}
	for(int i=n/2;i<n;i++){
		v2.push_back(v[i]);
	}
	for(int i=0;i<v2.size();i++){
		ans-=v2[i]*2LL;
		if(i<2){
			ans+=v2[i];
		}
	}
	ll s=0;
	reverse(all(v));
	for(int i=0;i<n/2;i++){
		s-=v[i]*2LL;
	}
	for(int i=n/2;i<n;i++){
		s+=v[i]*2LL;
		if(i<n/2+2){
			s-=v[i];
		}
	}
	ans=max(ans,s);
	}else{
		for(int i=0;i<n/2-1;i++){
			ans+=v[i]*2;
		}
		ans+=v[n/2-1];
		ans-=v[n/2];
		for(int i=n/2+1;i<n;i++){
			ans-=v[i]*2;
		}
	}
	cout<<ans<<endl;
}	


Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  int r,b;
  r = 0;
  b = 0;
  cin >> n >> s;
  for(int i = 0;i < n;i++){
    if(s[i] == 'R')++r;
    if(s[i] == 'B')++b;
  }
  if(r > b)cout << "Yes" << endl;
  if(r <= b)cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int DP [][] = new int[s.length()+1][t.length()+1];
        int List [][] = new int[s.length()+1][t.length()+1];
        StringBuilder opt = new StringBuilder();
        for(int i=0;i<s.length()+1;i++) DP[i][0]=0;
        for(int j=0;j<t.length()+1;j++) DP[0][j]=0;
        for(int i=1;i<=s.length();i++){
            for(int j=1;j<=t.length();j++){
                if(s.charAt(i-1)==t.charAt(j-1)){
                    DP[i][j]=DP[i-1][j-1]+1;
                    List[i][j] = 2;
                }
                else if(s.charAt(i-1)!=t.charAt(j-1)) {
                    DP[i][j] = Math.max(DP[i][j - 1], DP[i - 1][j]);
                    if(DP[i][j]==DP[i][j-1])List[i][j]=3;
                    else List[i][j]=1;
                }
            }
        }
       int i = s.length(), j = t.length();
        for(int k=0;k<s.length()*t.length();k++){
            if(s.charAt(i-1)==t.charAt(j-1)) opt.append(s.charAt(i-1));
            if(List[i][j]==1) i--;
            else if(List[i][j]==3) j--;
            else if(List[i][j]==2){
                i--;
                j--;
            }
            if(i==0||j==0) break;
        }
        for(i=opt.length()-1;i>=0;i--)System.out.print(opt.charAt(i));
        System.out.println();
    }
}

Measured memory_bytes: 129100
#include <bits/stdc++.h>
#define rep(a, b, c, i) for (int i = a; i < b; i += c)
#define MAX_INT 1000000007
#define ll long long
#define p(t1, t2, x) pair<t1, t2> x
#define v(t, x) vector<t> x
#define newl "\n"

using namespace std;

class HAndV{
public:
	int choices(vector<string> &grid, int k){
		int ans = 0;
		int h = grid.size();
		int w = grid[0].size();
		int bl;
		rep(0, (1 << h), 1, i){
			rep(0, (1 << w), 1, j){
				bl = 0;
				rep(0, h, 1, x){
					rep(0, w, 1, y){
						if ((((i >> x) & 1) == 0) && (((j >> y) & 1) == 0)){
							if (grid[x][y] == '#') ++bl;
						}
					}
				}
				if (bl == k) ++ans;
			}
		}
		return ans;
	}
};

int main(){
	int h, w, k;
	cin >> h >> w >> k;
	HAndV hnv;
	vector<string> grid;
	rep(0, h, 1, i){
		string s;
		cin >> s;
		grid.push_back(s);
	}
	cout << hnv.choices(grid, k) << newl;
}


Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll x, y;
	cin >> x >> y;

	println((bitset<32>(x) & bitset<32>(y)));
	println((bitset<32>(x) | bitset<32>(y)));
	println((bitset<32>(x) ^ bitset<32>(y)));
}



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

int main(){
    int H, W;
    cin >> H >> W;
    int table[H][W];
    int tableT[W][H];
    for(int i = 0;i < H;++i){
        string s;
        cin >> s;
        for(int j = 0;j < s.length();++j){
            if(s[j] == '#'){
                table[i][j] = 0;
                tableT[j][i] = 0;
            }else{
                table[i][j] = 1;
                tableT[j][i] = 1;
            }
        }
    }
    int counttable[H][W];
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            if(j == 0){
                counttable[i][j] = table[i][j];
            }else if(table[i][j] == 0){
                counttable[i][j] = table[i][j];
            }else{
                counttable[i][j] = table[i][j] + counttable[i][j-1];
            }
        }
    }
    int counttableT[W][H];
    for(int i = 0;i < W;++i){
        for(int j = 0;j < H;++j){
            if(j == 0){
                counttableT[i][j] = tableT[i][j];
            }else if(tableT[i][j] == 0){
                counttableT[i][j] = tableT[i][j];
            }else{
                counttableT[i][j] = tableT[i][j] + counttableT[i][j-1];
            }
        }
    }
    for(int i = 0;i < H;++i){
        for(int j = W-2;j > -1;--j){
            if(counttable[i][j] != 0 && counttable[i][j] < counttable[i][j+1]){
                counttable[i][j] = counttable[i][j+1];
            }
        }
    }
    for(int i = 0;i < W;++i){
        for(int j = H-2;j > -1;--j){
            if(counttableT[i][j] != 0 && counttableT[i][j] < counttableT[i][j+1]){
                counttableT[i][j] = counttableT[i][j+1];
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            ans = max(ans, counttable[i][j] + counttableT[j][i]);
        }
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 62720
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110000];
int q[110000];
long long P[110000];
long long Q[110000];
pair<long long,int> e[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	long long cur=0;
	for(int i=0;i<a;i++){
		scanf("%d%d",p+i,q+i);
		P[i]=(long long)p[i]*(100-b);
		Q[i]=-(long long)q[i]*b;
		e[i]=make_pair((-P[i]+Q[i]),i);
		cur+=Q[i];
	}
	std::sort(e,e+a);
	for(int i=0;i<a;i++){
		cur+=-e[i].first;
		if(cur>=0){
			printf("%d\n",i+1);break;
		}
	}
}

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

int main(){
  string s; cin >> s;
  int n= s.size();
  int ans1 =0;
  for(int i=0; i<n; i++){
    if(i%2==0){
      if(s[i]=='0'){
        ans1++;
      }
    }else{
      if(s[i]=='1'){
        ans1++;
      }
    }
  }int ans2=0;
  for(int i=0; i<n; i++){
    if(i%2==0){
      if(s[i]=='1'){
        ans2++;
      }
    }else{
      if(s[i]=='0'){
        ans2++;
      }
    }
  }
  cout << min(ans1,ans2) << endl;
}


Measured memory_bytes: 512
N = int(input())
a1 = 0 #AC
a2 = 0 #WA
a3 = 0 #TLE
a4 = 0 #RE

for i in range(N):
  s = input()
  if s == 'AC':
    a1 += 1
  if s == 'WA':
    a2 += 1
  if s == 'TLE':
    a3 += 1
  if s == 'RE':
    a4 += 1

    
print("AC x {}".format(a1))
print("WA x {}".format(a2))
print("TLE x {}".format(a3))
print("RE x {}".format(a4))

Measured memory_bytes: 9212
#include <iostream>
#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 ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int f(int a, int b) {
  return abs(a-b);
}

int main(int argc, char const* argv[])
{
  int n, k;
  cin>>n>>k;
  int dp[n+1];
  vector<int> hs(n+1);

  REP(i,n) cin>>hs[i];
  dp[0] = 0;

  REP1(i,n) {
    int d = i-k>=0 ? k : i;
    int min = 1001001001;
    REP1(j,d+1) min = min>dp[i-j]+f(hs[i-j],hs[i]) ? dp[i-j]+f(hs[i-j],hs[i]) : min;
    dp[i] = min;
  }

  cout << dp[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1024
a,b,c = [int(x) for x in input().split(' ')]
power = [0 for x in range(3)]
left = [0 for x in range(3)]

if a % 2 !=0 and b%2!=0 and c%2!=0:
    print(0)
    exit()

for index,value in enumerate([a,b,c]):
    store = value
    while store % 2 == 0:
        power[index] += 1
        store = store / 2
    left[index] = store
if min(power) != max(power):
    print(min(power))
else:
    inf = True
    r = left[0] % 4
    for value in left:
        if value % 4 != r:
            inf = False
            break
    if inf:
        print(-1)
    else:
        print(power[0] + 1)


Measured memory_bytes: 3064
import java.util.*;
import java.lang.Math;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String x = sc.next();
	String[] xArray = new String[x.length()];
    int[] c = new int[xArray.length -2];
    
	for(int i = 0;i < x.length(); i++){
      xArray[i] = String.valueOf(x.charAt(i));
    }
    
    int scg = 753;
    for(int i = 0;i < xArray.length - 2;i++){
      c[i] = Math.abs(Integer.parseInt(xArray[i] + xArray[i + 1] + xArray[i + 2]) - scg);
    }
    
    int min = 10000;
    for(int i = 0; i < c.length;i++){
      min = Math.min(min,c[i]);
    }
      System.out.println(min);
  }
}

Measured memory_bytes: 22612
#include <iostream>

using namespace std;

int main() {
    int N, Q;

    cin >> N >> Q;
    int counts[N];
    bool has[N];

    for (int j = 0; j < N; ++j) {
        counts[j] = 1;
        has[j] = false;
    }
    has[0] = true;

    for (int i = 0; i < Q; ++i) {
        int a, b;
        cin >> a >> b;
        a --;
        b --;
        counts[a] --;
        counts[b] ++;
        has[b] = has[b] || has[a];
        if (counts[a] == 0) {
            has[a] = false;
        }
    }
    int c = 0;
    for (int k = 0; k < N; ++k) {
        c += has[k] ? 1 : 0;
    }
    cout << c;
    return 0;
}



Measured memory_bytes: 768
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()



int main() {
	ll H, W;
	cin >> H >> W;
	if (H == 1 || W == 1) {
		cout << 1 << endl
			;
		return 0;
	}
	cout << H * W / 2 + (H * W) % 2 << endl;
}

Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
//#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
//#include <ordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)1e6 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, a[N], b[N], st;
bool used[N];
string s[N];
vector <pii> v1, v2;

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> n;
   for (int i = 1; i <= n; i ++) {
      cin >> s[i];
      a[i] = b[i] = 0;
      for (int j = 0; j < sz (s[i]); j ++) {
         if (s[i][j] == '(') a[i] ++;
         else {
            if (a[i] > 0) a[i] --;
            else b[i] ++;
         }
      }
      if (b[i] == 0) st += a[i];
      else {
         if (a[i] - b[i] >= 0) v1.pb ({b[i], a[i]});
         else v2.pb ({a[i], b[i]});
      }
   }
   sort (all (v1));
   sort (all (v2));
   reverse (all (v2));
   for (int i = 0; i < sz (v1); i ++) {
      st -= v1[i].F;
      if (st < 0) cout << "No", exit (0);
      st += v1[i].S;
   }
   for (int i = 0; i < sz (v2); i ++) {
      st -= v2[i].S;
      if (st < 0) cout << "No", exit (0);
      st += v2[i].F;
   }
   if (st != 0) cout << "No";
   else cout << "Yes";
}               
 
signed main () {                                       
   //#ifdef QWERTY
   //   freopen("input", "r", stdin);
   //#endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Measured memory_bytes: 46432
a, b, c = map(int, input().split())
if a == b == c:
    if a & 1:
        print(0)
    else:
        print(-1)
    exit()

count = 0
while True:
    if (a | b | c) & 1:
        break
    half_a = a // 2
    half_b = b // 2
    half_c = c // 2
    a = half_b + half_c
    b = half_a + half_c
    c = half_a + half_b
    count += 1
print(count)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	vector<int> s(9);
  	for(int i=0;i<9;i++){
    	
         cin >> s.at(i); 
        
    }
  	int n;
  	cin >> n;
  	vector<int> m(n);
  	for(int i=0;i<n;i++){
      cin >> m.at(i);
      for(int j=0;j<9;j++){
      	if(m.at(i) == s.at(j)) s.at(j) = 0;
      }
    }
  	bool e = false;
  	for(int i=0;i<3;i++){
    	if(s.at(i) == 0 && s.at(i+3) == 0 && s.at(i+6) == 0){
             	e = true;
              	break;
        }
    }
       if(s.at(0) == 0 && s.at(1) == 0 && s.at(2) == 0){
             	e = true;
        }
  if(s.at(3) == 0 && s.at(4) == 0 && s.at(5) == 0){
             	e = true;
        }
  if(s.at(6) == 0 && s.at(7) == 0 && s.at(8) == 0){
             	e = true;
        }
  if(s.at(0) == 0 && s.at(4) == 0 && s.at(8) == 0){
             	e = true;
        }
     if(s.at(2) == 0 && s.at(4) == 0 && s.at(6) == 0){
             	e = true;
        }
  if(e == true) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(){
  int i,j,n;
  while(scanf("%d",&n)){
    if (n==0)
      break;
    int data[n+1][n+1];
    for (i=0;i<n;i++){
      int sum=0;
      for (j=0;j<n;j++){
        scanf("%d",&data[i][j]);
        sum+=data[i][j];
      }
      data[i][n]=sum;
    }

    for (i=0;i<n+1;i++){
      int sum=0;
      for (j=0;j<n;j++)
        sum+=data[j][i];
      data[n][i]=sum;
    }

    for (i=0;i<n+1;i++){
      for (j=0;j<n+1;j++)
        printf("%5d",data[i][j]);
      printf("\n");
    }

  }

  return 0;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (a * b >= c * d)
        cout << a * b << endl;
    else
        cout << c * d << endl;

    return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std; 
int main(){
  int L,A,B,C,D;
  cin>>L>>A>>B>>C>>D;
  int Jday,Mday;
  if(A%C==0){
    Jday=A/C;
  }
  else Jday=A/C+1;
  if(B%D==0){
    Mday=B/D;
  }
  else Mday=B/D+1;

  if(Jday>Mday){
    cout<<L-Jday<<endl;
  }
  else {
    cout<<L-Mday<<endl;
  }

return 0;
}

Measured memory_bytes: 3088
#!/usr/bin/perl

use strict;
use warnings;

my ($n, $m);
{
    my $in = <STDIN>;
    ($n, $m) = split(" ", $in);
}
my @x =map{0}(0..$n);
my @y =map{0}(0..$n);
for (my $i=0; $i<$m; $i++)
{
    my $in = <STDIN>;
    my ($p, $s);
    ($p, $s) = split(" ", $in);
    chomp $s;
    $x[$p]++ if $y[$p] == 0 && $s eq "WA";
    $y[$p] = 1 if $s eq "AC";

}
my ($a, $b) = (0, 0);
for (0..$n)
{
    $a+=$y[$_];
    $b+=$x[$_] if $y[$_]==1;
}
print "$a $b\n";

Measured memory_bytes: 14080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (1LL<<59)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];
VI fg[4];
map<char, int> ms = {{'R', 1}, {'G', 2}, {'B', 3}};

void solve(int T)
{
	int n;
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++)
	fg[ms[s[i]]].pb(i);
	ll rx = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(s[i] != s[j])
			{
				int uy = ms[s[i]] ^ ms[s[j]];
				rx += ((ll)fg[uy].sz() - 1LL*(upper_bound(begin(fg[uy]), end(fg[uy]), j) - begin(fg[uy])));
				if((lower_bound(begin(fg[uy]), end(fg[uy]), j + (j-i)) != end(fg[uy])) && (*lower_bound(begin(fg[uy]), end(fg[uy]), j + (j-i)) == j + (j-i)))
				rx--;
			}	
		}
	}
	cout<<rx<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	//cin>>T;
	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0;
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0)
using namespace std;
vector<ll>V,L,L1;
vector<pair<char,ll>>B;
vector<string>Ans;
map<int,int>M;
set<ll>S;
set<char>:: iterator it;
ll n,m,a,b,c,d,e,f,x,y,z,t,l,r,ans,cnt,score;
string   s,winner,temp,p;
ll arr[1001];
bool xy=0;
char bd;
float ans1;
int main()
{
    TIME;
    cin>>n>>m;
    for (int i =0; i <n; i ++ )
        cin>>a,V.pb(a);
    sort(V.begin(),V.end());
    for (int i =0; i <m; i ++ )
        cnt+=V[i];
    cout<<cnt;


}


Measured memory_bytes: 3672
n,k=map(int,input().split())
m=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for i in a:
    if i not in m:
      m.append(i)
mx=max(m)
c=0
for i in range(1,n+1):
  if(i not in m):
    c+=1
print(c)    

Measured memory_bytes: 9184
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int e = Integer.parseInt(sc.next());
        int f = Integer.parseInt(sc.next());
        Set<Integer> setX = new TreeSet<>();
        Set<Integer> setY = new TreeSet<>();
        for (int i = 0; i <= f / (a * 100); i++) {
            for (int j = 0; j <= f / (b * 100); j++) {
                int temp = a * 100 * i + b * 100 * j;
                if (temp > 0 && temp <= f) {
                    setX.add(temp);
                }
            }
        }
        for (int i = 0; i <= f / c; i++) {
            for (int j = 0; j <= f / d; j++) {
                int temp = c * i + d * j;
                if (temp <= f) {
                    setY.add(temp);
                }
            }
        }
        double ans = 0;
        double temp = 0;
        int ansx = 0;
        int ansy = 0;
        for (int x : setX) {
            for (int y : setY) {
                temp = y * 1.0 / (x + y);
                if (temp <= (e / (e + 100.0)) && ans <= temp && x + y <= f) {
                    ans = temp;
                    ansx = x;
                    ansy = y;
                }
            }
        }
        System.out.println(ansx + ansy + " " + ansy);
    }
}

Measured memory_bytes: 25064
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;  typedef long long ll;
inline int qr(){
	int ret=0,f=0,c=getchar();
	while(!isdigit(c)) f|=c==45,c=getchar();
	while( isdigit(c)) ret=ret*10+c-48,c=getchar();
	return f?-ret:ret;
}
const int maxn=3e5+5;;
ll seg[maxn];
void add(int pos,ll val){
	for(int t=pos;t<maxn;t+=t&-t)
		seg[t]+=val;
}
ll que(int pos){
	ll ret=0;
	for(int t=pos;t>0;t-=t&-t)
		ret+=seg[t];
	return ret;		
}

ll getSigma(vector<int>ve){
	ll ret=0;
	memset(seg,0,sizeof seg);
	reverse(ve.begin(),ve.end());
	for(auto t:ve) ret+=que(t),add(t,1);
	return ret;
}

int main(){
	vector<int>ve(qr()),ji,ou;
	int f=0;
	for(auto&t:ve) t=qr(),f^=1,f?ji.push_back(t):ou.push_back(t);
	if(getSigma(ve)==(getSigma(ji)+getSigma(ou))*3ll) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 7532
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
using namespace std;
using ll =long long;

int main() {
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {

		cout << "x";


	}

}

Measured memory_bytes: 256
H, W = map(int, input().split())
a = H % 2
b = W % 2
c = H * W
d = int(c // 2)
if H == 1 or W == 1:
    print(1)
else:
    if a == 1 and b == 1:
        print(d + 1)
    else:
        print(d)

Measured memory_bytes: 3060
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    cin>>N;
    if(N>=1000)cout<<"ABD"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    set<pair<int, int>> a;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.insert({-x, i});
    }
    for (int i = 0; i < m; i++) {
        auto p = *a.begin();
        a.erase(p);
        p.first /= 2;
        a.insert(p);
    }
    long res = 0;
    for (auto p : a) {
        res += p.first;
    }
    cout << -res;

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    
    string s;cin>>s;
    ll ans1=0,ans2=0;
    rep(i,0,s.size()-1){
        if((i%2==0&&s[i]=='0')||(i%2==1&&s[i]=='1'))ans1++;
        else ans2++;
    }
    cout<<min(ans1,ans2)<<endl;
    return 0;
}





Measured memory_bytes: 512
N = int(input())

D = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for i in range(N):
    x = input()
    if x == "AC":
        D["AC"] += 1 
    elif x == "WA":
        D["WA"] += 1
    elif x == "TLE":
        D["TLE"] += 1
    else:
        D["RE"] += 1

print("AC x", D["AC"])
print("WA x", D["WA"])
print("TLE x", D["TLE"])
print("RE x", D["RE"])

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  int ans=0;
  for(int i=1;i<=N;i+=2){
    int count=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        count++;
      }
    }
    if(count==8){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
3 2
)");
#define cin input
#endif

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	cout << (a == b && b == c ? "Yes" : "No") << endl;

	return 0;
}


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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  string s;
  int sum = 700;
  cin >> s;
  for (int i = 0; i < 3; i++){
    if (s[i] == 'o'){
      sum += 100;
    }
  }
  cout << sum << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int a,b,c,x,y;
scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);

int an=x,bn=y,cn=0;

int total=an*a+bn*b,i,tempt;

for(i=0;;++i){
	an=(an==0)?0:an-1;
	bn=(bn==0)?0:bn-1;
	cn+=2;
	tempt=an*a+bn*b+cn*c;
	if(total>tempt) total=tempt;
	else break;
}

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

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
struct node{
	double x,y;
}a,b;
node operator - (node a,node b)
{
	return (node){a.x-b.x,a.y-b.y};
}
double DJ(node a,node b)
{
	return a.x*b.x+a.y*b.y;
}
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	a=(node){read(),read()};
	b=(node){read(),read()};
	int n=read();
	while(n--)
	{
		node x=(node){read(),read()};
		double xu=DJ(b-a,x-a);
		double jia=DJ(b-a,b-a);
		double hao=xu/jia;
		printf("%.10lf %.10lf\n",a.x+(b.x-a.x)*hao,a.y+(b.y-a.y)*hao);
	}
	return 0;
}


Measured memory_bytes: 3232
#pragma GCC optimize ("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<cmath>
#include<cstdio>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
#include<valarray>
#include<vector>
#include<array>
#include<forward_list>
#include<random>
#include<ratio>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<cstring>

using namespace std;
using Int = long long; using uint = unsigned int; using uInt = unsigned long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rer(i,l,r) for(int i=(l); i<=(r); ++i)
#define gnr(i,l,r) for(int i=(r); i>=(l); --i)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
#define priend(a) {cout<<(a)<<'\n'; return 0;}
#define fil(a,v) memset((a),v,sizeof(a))
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char ch;

int main(){
  cin.tie(nullptr); ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(20);

  cin>>n; pair<double,double> a[n]; rep(i,n)cin>>a[i].fi>>a[i].se;
  sort(a,a+n); double ans=0;
  do{
    double co=0;
    rep(i,n-1){
      co+=sqrt((a[i+1].fi-a[i].fi)*(a[i+1].fi-a[i].fi)+(a[i+1].se-a[i].se)*(a[i+1].se-a[i].se));
    }
    ans+=co;
  }while(next_permutation(a,a+n));
  int p=1; rer(i,2,n)p*=i;
  pri1(ans/p);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,i,flag,c ;
    cin>>n;
    getchar();
    string s;
    getline(cin,s);
   x=(n)/2;
   string tmp="No";
   if(n%2==0&&s.substr(0,x)==s.substr(x,n))tmp="Yes";


   cout<<tmp<<endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a, b, d, r;
	double f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a % b;
	f = 1.00000 * a / b;
	printf("%d %d %.6lf\n", d, r, f);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
using namespace std;
int main()
{
 int flag=0,l,ct=0;
 string s;
 cin>>s;
 l=s.size();
 if(s[0]!='A'){
    flag=1;
 }
 if(s[1]>='a'&&s[1]<='z'){
 }
 else{
    flag=1;
 }
 for(int i=0;i<l-3;i++){
    if(s[i+2]=='C'){
        ct++;
    }
    else if(s[i+2]>='a'&&s[i+2]<='z'){
    }
    else{
        flag=1;
    }
 }
 if(s[l-1]>='a'&&s[l-1]<='z'){
 }
 else{
    flag=1;
 }
 if(flag!=1&&ct==1){
    cout<<"AC";
 }
 else{
    cout<<"WA";
 }
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100100;
vector<int> es[N];
int d[N]={0};
void ae(int u,int v){
	es[u].push_back(v);
}
struct UFS{
	int fa[N];
	void init(int n){
		for(int i=0;i<=n;i++)fa[i]=i;
	}
	int find(int x){
		return fa[x]==x?x:fa[x]=find(fa[x]);
	}
	bool merge(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b)return false;
		fa[a]=b;
		return true;
	}
}ufs;
void dfs(int x,int fa=-1){
	for(vector<int>::iterator it=es[x].begin();it!=es[x].end();++it){
		if(*it!=fa){
			dfs(*it,x);
		}
	}
	if(fa!=-1){
		if(d[x]==1){
			printf("%d %d\n",x,fa);
			d[x]^=1;
		}
		else{
			printf("%d %d\n",fa,x);
			d[fa]^=1;
		}
	}
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(m%2!=0){
		printf("-1\n");
		exit(0);
	}
	ufs.init(n);
	while(m--){
		int u,v;
		scanf("%d%d",&u,&v);
		if(!ufs.merge(u,v)){
			printf("%d %d\n",u,v);
			d[u]^=1;
		}
		else{
			ae(u,v);
			ae(v,u);
		}
	}
	dfs(1);
	return 0;
}

Measured memory_bytes: 11648
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   Integer oi = new Integer(N);
	String str = oi.toString();

   if(str.contains("7")){
     System.out.println("Yes");
   }else{
     System.out.println("No");
   }
 
 }
}


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

int main(){
  
  int n;
  cin >> n;
  string s,ans = "No";
  cin >> s;
  if(n%2 == 0){
  	if(s.substr(0,n/2) == s.substr(n/2)){
    	ans = "Yes";
    }

  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

constexpr int inf = 1000000010;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n, a, b;
	cin >> n >> a >> b; a -= b;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	int ng = 0, ok = inf;
	while (ok - ng > 1) {
		int mid = (ng + ok) / 2;
		int cnt = 0;
		rep(i, n) {
			int c = h[i] - mid * b;
			if (c >= 0) cnt += (c + a - 1) / a;
		}
		if (cnt <= mid) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}

Measured memory_bytes: 1024
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//abc142E
int main(void) {
  int n, m, i, j, tmp, big=1000000;
  scanf("%d %d", &n, &m);
  int com=pow(2, n), a[m], b[m], c[m][12], dp[com];
  for(i=0; i < com; i++) dp[i]=big;//BitDPの最小値を超大きく仮定

  for(i=0; i < m; i++){
    scanf("%d %d", &a[i], &b[i]);
    for(j=0; j < b[i]; j++) scanf("%d", &c[i][j]);
    tmp=0;
    for(j=0; j < b[i]; j++) tmp+=pow(2, c[i][j] - 1);
    if(dp[tmp] > a[i]) dp[tmp]=a[i];
    for(j=0; j < com; j++) if(dp[j] != big && dp[j | tmp] > dp[j] + a[i]) dp[j | tmp]=dp[j] + a[i];
  }
  if(dp[com - 1] == big) printf("-1");
  else printf("%d", dp[com - 1]);
  return 0;
}

Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,K;

LL ans = 0;

void solve(){
	ans = min(N%K,abs(K-N%K));
}

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

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

Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define INF 1050000000;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main() //input->compute->output
{
        int N;
        cin >> N;
        vector<int> h(N);
        rep(i, N)
        {
                cin >> h[i];
        }

        int dp[100000 + 1];
        dp[0] = 0;
        dp[1] = abs(h[1] - h[0]);
        for (int i = 2; i < N; i++)
        {
                dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
        }

        cout << dp[N - 1] << endl;
        return 0;
}

Measured memory_bytes: 1024