akhauriyash/Code-Regression huggingface dataset:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n,q = map(int, input().split())
    s = input()
    cumsum = list()

    for i in  range(n+1):
        if i == 0:
            cumsum.append(0)
        else:
            if i > 1 and  s[i-2:i] == 'AC':
                
                cumsum.append(cumsum[i-1] + 1)
            else:
                cumsum.append(cumsum[i-1])
    #print(cumsum)
    for i in range(q):
        l,r = map(int, input().split())
        print(cumsum[r] - cumsum[l])
    
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 8516
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int Inf = 1000000000;
const ll INF= 1e18;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int dp[1010][10010];

int main() {
    int H,N;
    cin >> H >> N;
    vector<int> w(N);
    vector<int> v(N);
    for(int i = 0;i < N;i++) {
        cin >> w.at(i) >> v.at(i);
    }
    for(int i = 0;i < 1010;i++) {
        for(int j = 0;j < 10010;j++) {
            dp[i][j] = Inf;
        }
    }
    dp[0][0] = 0;
    for(int i = 0;i < N;i++) {
        for(int j = 0;j <= H;j++) {
            dp[i + 1][j] = min(dp[i + 1][j],dp[i][j]);
            dp[i + 1][min(j + w.at(i),H)] = min(dp[i + 1][min(j + w.at(i),H)],dp[i + 1][j] + v.at(i));
        }
    }
    cout << dp[N][H] << endl;
}

Measured memory_bytes: 39808
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int x[N],t[N],l[N],r[N];ll ans;
int main()
{	int n,L,A=0,B=0; cin>>n>>L;
	for(rint i=1;i<=n;i++) scanf("%d",&x[i]);
	for(rint i=1;i<=n;i++)
	{	scanf("%d",&t[i]),ans+=t[i]/(L<<1)+1,t[i]%=(L<<1),ans-=(!t[i]);
		if(t[i]) l[i]=(t[i]<=2*(L-x[i])),r[i]=(t[i]<=2*x[i]);
	}
	for(rint i=1;i<n;i++)
	{	if(l[i])
		{	if(A) A--,ans--,B+=(!!r[i]);
			else if(r[i]) A++;
			else if(B) B--,A++;
		}
		else if(r[i]) A++;
	}
	cout<<(ans+(!l[n]))*2*L<<endl;
	return 0;
}

Measured memory_bytes: 13696
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut tcnt = 0;
    let mut hcnt = 0;
    for _ in 0..n {
        let t:String = read();
        let h:String = read();
        if t > h {
            tcnt += 3;
        } else if t == h {
            tcnt += 1;
            hcnt += 1;
        } else {
            hcnt += 3;
        }
    }
    println!("{} {}",tcnt, hcnt);
}


Measured memory_bytes: 5036
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;


int main(void){

    string N; cin>>N;
    for (int i = 0; i < 3; ++i) {
        if(N[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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

	
	string S;
	cin >> S;

	string kotae1 = "-1", kotae2 = "-1";

	rep(i, 26) {
		int A[100100] = {};
		rep(ii, S.size()) if (S[ii] == 'a' + i) A[ii + 1] = 1;
		
		rep1(ii, S.size()) {
			if (A[ii] > 0) A[ii] += A[ii - 1];
			else A[ii] = 0;
		}

		rep(ii, S.size() + 1) {
			if (A[ii] == 2) {
				kotae1 = to_string(ii - 1);
				kotae2 = to_string(ii);
			}
			if (A[ii] == 1 && A[ii + 2] == 1) {
				kotae1 = to_string(ii);
				kotae2 = to_string(ii + 2);
			}
		}
	}
	cosp(kotae1);
	co(kotae2);

	Would you please return 0;
}

Measured memory_bytes: 848
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N;
    cin >> N;
    double ans = 0.0;
    for (int i = 0; i < N; i++) {
        double t;
        cin >> t;
        ans += 1.0 / t;
    }
    cout << fixed << setprecision(8);
    cout << 1.0 / ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var arr = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()

    var prev = arr[0]
    var max = Int.MIN_VALUE
    var total : Long = 0
    for(i in 0..arr.lastIndex)
    {
        max = Math.max(max,arr[i])
        total += max - arr[i]

    }
    println(total)
}


Measured memory_bytes: 84092
h, w = gets.chomp.split(' ').map(&:to_i)
s = []
h.times { s << gets.chomp.each_char.to_a }

def count(i, j, h, w, m)
  direction = [
      [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0],
      [-1, -1], [0, -1], [1, -1]
  ]
  if m[j][i] == '#'
    '#'
  else
    direction.map do |di|
      next 0 unless (0...w).cover?(i + di[0]) && (0...h).cover?(j + di[1])
      if m[j + di[1]][i + di[0]] == '#'
        1
      else
        0
      end
    end.inject(:+)
  end
end

0.upto(h-1) do |j|
  0.upto(w-1) do |i|
    print count(i, j, h, w, s)
  end
  puts
end


Measured memory_bytes: 2172
#include<stdio.h>

int main(){
  char b[1];
  scanf("%s",&b[0]);
  if(b[0] == 'A') printf("T");
  if(b[0] == 'T') printf("A");
  if(b[0] == 'C') printf("G");
  if(b[0] == 'G') printf("C");
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct {
    double x;
    double y;
    double theta;
} xystruct;

int comp(const void* a, const void* b)
{
  double d=((xystruct*)a)->theta - ((xystruct*)b)->theta;
  if(d>0) return 1;
  else if(d<0) return -1;
  else return 0;
}

int main()
{
    int n;
    int i,j;
    xystruct xy[100];
    double dist,maxd;
    double X;
    double Y;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%lf%lf", &xy[i].x, &xy[i].y);
        if(fabs(xy[i].x) < 0.0000000001 && fabs(xy[i].y) < 0.0000000001){
          xy[i].theta=0;
        }else{
          xy[i].theta=atan2(xy[i].y, xy[i].x);
        }
    }
    qsort(xy, n, sizeof(xystruct), comp);
  
    maxd = 0;
    for (i = 0; i < n; i++) {
        X=0.;
        Y=0.;
        for (j = 0; j < n; j++) {
            X+=xy[(i+j)%n].x;
            Y+=xy[(i+j)%n].y;
            dist = X * X + Y * Y;
            if (dist > maxd) maxd = dist;
        }
    }
    printf("%.12lf\n", sqrt(maxd));
    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll L;
ll A[200050];
ll sum[200050];
ll even[200050];
ll odd[200050];
ll even_after[200050];
ll even_before[200050];
ll odd_after[200050];
ll odd_before[200050];

int main() {
    //cout.precision(10);
    cin >> L;
    for(int i = 1; i <= L; i++) {
        cin >> A[i];
        sum[i] = sum[i - 1] + A[i];
        even[i] = even[i - 1];
        if(A[i] % 2 == 1) even[i]++;
        if(A[i] == 0) even[i] += 2;
        odd[i] = odd[i - 1];
        if(A[i] % 2 == 0) odd[i]++;
    }
    for(int i = 1; i <= L; i++) {

        int here_left_here_cost = 0;
        int left_here_cost = 0;
        if (A[i] == 0) {
            left_here_cost = 1;
            here_left_here_cost = 2;
        } else if (A[i] % 2 == 0) {
            left_here_cost = 1;
        } else {
            here_left_here_cost = 1;
        }

        even_before[i] = min(even_before[i - 1] + here_left_here_cost, sum[i]);
        odd_before[i] = min(odd_before[i - 1] + left_here_cost, even_before[i]);
    }
    for (int i = L - 1; i >= 0; i--) {
        even_after[i] = min(even_after[i + 1] + (even[i + 1] - even[i]), sum[L] - sum[i]);
        odd_after[i] = min(odd_after[i + 1] + (odd[i + 1] - odd[i]), even_after[i]);
    }
    ll ans = 1e16;
    for(int i = 0; i <= L; i++) {
        ans = min(ans, odd_before[i] + odd_after[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12800
import sys
sys.setrecursionlimit(10 ** 7)
from bisect import bisect_left
def resolve():
    def dfs(s, parent):
        a = A[s]
        i = bisect_left(dp, a)
        v = dp[i]
        dp[i] = a
        ans[s] = bisect_left(dp, INF)
        for to in G[s]:
            if to == parent:
                continue
            dfs(to, s)
        # 頂点sでの結果をもとに戻す
        dp[i] = v
        return


    N = int(input())
    A = tuple(map(int, input().split()))
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(lambda x:int(x)-1, input().split())
        G[a].append(b)
        G[b].append(a)

    INF = 10 ** 18
    dp = [INF] * N
    ans = [0] * N

    dfs(0, -1)
    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 283812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);


    int N,M; cin >> N >> M;
    VI dig(N,-1);
    REP(i,M){
        int s,c; cin >> s >> c;
        if(s > N){
            cout << -1 << endl;
            return 0;
        }

        if(dig[s-1] == -1){
            dig[s-1] = c;
        }else{
            if(dig[s-1] != c){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    if(dig[0] == 0 && N != 1){
        cout << -1 << endl;
        return 0;
    }
    if(dig[0] == -1){
        if(N == 1) dig[0] = 0;
        else dig[0] = 1;
    }
    REP(i,N){
        if(dig[i] == -1){
            cout << 0;
        }else{
            cout << dig[i];
        }
    }
    cout << endl;


}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int[] a = new int[n];
      int g = 0;
      int max = 0;
      for(int i = 0;i < n;i++){
        a[i]=sc.nextInt();
        g = gcd(g,a[i]);
        max = Math.max(max,a[i]);
      }
      if(k%g==0&&k<=max)System.out.println("POSSIBLE");
      else System.out.println("IMPOSSIBLE");
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 50444
#include <iostream>
#define maxn 3000
using namespace std;
double dp[maxn][maxn];
int main() {
	ios::sync_with_stdio(false);
	//   sync_with_YinHsuan(true);
	cin.tie(0);
	int n;
	double p, ans = 0;
	cin >> n >> p;
	dp[1][0] = p;
	dp[0][1] = 1-p;
	for ( int i=2; i<=n; ++i ) {
		cin >> p;
		for ( int j=0; j<i; ++j ) {
			dp[i-j][j] += dp[i-1-j][j] * p;
			dp[j][i-j] += dp[j][i-1-j] * (1-p);
		}
	}
	for ( int i=n; i>(n-i); --i )	ans += dp[i][n-i];
	printf("%.10lf\n", ans);
	return 0;
}


Measured memory_bytes: 70016
A,B = map(int,input().split())
if A == 1 and B == 1:
    print("Draw")
elif A == 1:
    print("Alice")
elif B == 1:
    print("Bob")
else:
    if A > B:
        print("Alice")
    elif A < B:
        print("Bob")
    else:
        print("Draw")

Measured memory_bytes: 3060
N,x = map(int,input().split())
a = list(map(int,input().split()))

ans = 0

for i in range(N-1):
    s = a[i] + a[i+1]

    if s <= x:
        continue
    else:
        a[i+1] = max(0,a[i+1]-(s-x))
        ans += s-x

print(ans)

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

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

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n,m;cin>>n>>m;
  vector<pint> ps(m);
  vint sum(n,0);
  vint wa(n,0);
  rep(i,m){
    int p;string s;
    cin>>p>>s;p--;
    if(sum[p]>0){
     continue;
    }else if(s=="WA"){
      wa[p]++;
    }else{
      sum[p]++;
    }
  }
  rep(i,n)if(sum[i]==0)wa[i]=0;
  cout << accumulate(all(sum),0) << " " << accumulate(all(wa),0) << endl;


}


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

int main(){
    int a, b;
    cin >> a >> b;
    if (a<=0 && b>=0) cout << "Zero";
    else if (a > 0 && b > 0) cout << "Positive";
    else {
		if ((b-a)%2 == 0) cout << "Negative";
		else cout << "Positive";
	}
		
}



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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        double x1,x2,x3;
        double y1,y2,y3;
        cin 
            >> x1 >> y1
            >> x2 >> y2
            >> x3 >> y3;
        double l12 = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        double l23 = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
        double l31 = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
        double cos123 = (l12*l12 + l23*l23 - l31*l31)/(2.0*l12*l23);
        double sin123 = sqrt(1.0-cos123*cos123);
        double r = l31 / (2.0*sin123);
        double coeff[4];
        double a = l23 * l23; // 1
        double b = l31 * l31; // 2
        double c = l12 * l12; // 3
        coeff[0] = a * ( b + c - a );
        coeff[1] = b * ( c + a - b );
        coeff[2] = c * ( a + b - c );
        coeff[3] = coeff[0] + coeff[1] + coeff[2];
        double xc = (coeff[0]*x1+coeff[1]*x2+coeff[2]*x3)/coeff[3];
        double yc = (coeff[0]*y1+coeff[1]*y2+coeff[2]*y3)/coeff[3];
#define sishagonyu(x) round(x*1000.0)/1000.0
        xc = sishagonyu(xc);
        yc = sishagonyu(yc);
        r  = sishagonyu(r);
        printf("%1.3f %1.3f %1.3f\n",
                xc,yc,r);
    }

    return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD 1000000007
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

signed main(){
    FASTER;
    int n,k;cin>>n>>k;
    vi v(n),dp(n,MOD);cin>>v;
    dp[0]=0;
    for(int i=1;i<=k;i++)dp[i]=abs(v[0]-v[i]);

    for(int i=k+1;i<n;i++){
        for(int j=1;j<=k;j++){
            dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
        }
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		
		int min = 1000;
		int max = 0;
		for(int i = 0; i < n; i++){
			min = Math.min(min, a[i]);
			max = Math.max(max, a[i]);
		}
		
		System.out.println(max - min);
	}
	

}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;


int main(void){
    string s;
    cin>>s;
    for(int i=1;i<s.length();i++){
        if(i==1){
            if(s[i-1]==s[i]){
                cout<<i<<" "<<i+1<<endl;
                return 0;
            }
        }
        else{
            if(s[i-1]==s[i]){
                cout<<i<<" "<<i+1<<endl;
                return 0;
            }
            else{
                if(s[i-2]==s[i]){
                    cout<<i-1<<" "<<i+1<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int H, W;
        cin >> H >> W;

        vector<string> vs(H);
        rep(i, 0, H) cin >> vs[i];

        vector<vector<int>> yoko(H, vector<int>(W)), tate(H, vector<int>(W));

        for (int i = 0; i < H; ++i) {
            yoko[i][0] = vs[i][0] == '.';
            for (int j = 0; j + 1 < W; ++j) {
                if (vs[i][j + 1] == '#') {
                    yoko[i][j + 1] = 0;
                } else {
                    yoko[i][j + 1] = yoko[i][j] + 1;
                }
            }
            for (int j = W - 1; j > 0; --j) {
                if (vs[i][j - 1] == '.') {
                    chmax(yoko[i][j - 1], yoko[i][j]);
                }
            }
        }

        for (int j = 0; j < W; ++j) {
            tate[0][j] = vs[0][j] == '.';
            for (int i = 0; i + 1 < H; ++i) {
                if (vs[i + 1][j] == '#') {
                    tate[i + 1][j] = 0;
                } else {
                    tate[i + 1][j] = tate[i][j] + 1;
                }
            }
            for (int i = H - 1; i > 0; --i) {
                if (vs[i - 1][j] == '.') {
                    chmax(tate[i - 1][j], tate[i][j]);
                }
            }
        }

        int ans = 0;
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                int tmp = tate[i][j] + yoko[i][j] - 1;
                if (tmp > ans) {
                    chmax(ans, tmp);
                }
            }
        }
        cout << ans << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 37760
// In the name of Allah
// #Isart
// yedoone bashe, mashti bashe ...

#include<bits/stdc++.h>

#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double

using namespace std;

const int MAXN = 1e5 + 10, mod = 1e9 + 7;
bool mark[MAXN];

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	ll ans = 1;
	for(int i = 2; i <= n; i ++){
		if(mark[i] == true) continue;
		ll cnt = 0;
		for(int j = i; j <= n; j += i){
			mark[j] = true;
			int num = j;
			while(num % i == 0){
				num /= i;
				cnt ++;
			}
		}
		ans = ans * (cnt + 1) % mod;
	}
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	#define int long long int
	#define pb push_back
	const int mod=1e9+7;
	#define all(x) x.begin(),x.end()
	#define endl '\n'
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
	
	int add(int x,int y){
		x+=y;
		while(x>=mod)x-=mod;
		while(x<0)x+=mod;
		return x;
	}
	int mul(int a,int b){
		return (a*b)%mod;
	}
	int fast(int a,int b){
		int res=1ll;
		while(b){
			if(b&1)res=mul(res,a);
			a=mul(a,a);
			b>>=1;
		}
		return res;
	}
	int inverse(int x){
		return fast(x,mod-2);
	}
	int divide(int a,int b){
		return mul(a,inverse(b));
		
	}
	int fact[200066];
	void factorial(){
		fact[0]=1;
		for(int i=1;i<200066;i++){
			fact[i]=mul(fact[i-1],i);
		}
	}
	
	int Comb(int n,int k){
		return divide(fact[n],mul(fact[k],fact[n-k]));
	}
	
/*-----------------------------------------------------------------------------------------------------*/	
/*-----------------------------------------------------------------------------------------------------*/	

	
	int32_t main(){
		IOS;
		map<int,int>mp;
		for(int i=1;i<=150;i++){
			for(int j=1;j<150;j++){
				for(int k=1;k<150;k++){
					int x=i*i+j*j+k*k+i*j+j*k+k*i;
					mp[x]++;
				}
			}
		}
		int n;
		cin>>n;
		for(int i=1;i<=n;i++){
			cout<<mp[i]<<endl;
		}
		return 0;
	}


Measured memory_bytes: 9392
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    if (s == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3552
#include<stdio.h>

int main(void){
	int A1, A2, A3;
	do{
		scanf("%d%d%d", &A1, &A2, &A3);
	}while(A1 < 1 || A1 > 13 || A2 < 1 || A2 > 13 || A3 < 1 || A3 > 13);

	if(A1 + A2 + A3 >= 22)	printf("bust\n");
	else	printf("win\n");

	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    ll s = 0;
    rep(i, n) cin >> a[i];

    ll minv = 1e15;
    ll flont_sum = 0, back_sum = accumulate(ALL(a), (ll)0);
    ll sum = 0;

    rep(i, n - 1)
    {
        sum += a[i];
        //flont_sum += a[i];
        //back_sum -= a[i];
        minv = min(minv, abs(back_sum - 2 * sum));
    }

    OP(minv);

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a;
	cin >> a;
	cout << 48 - a << "\n";

	return 0;
}


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

int main(){
    LL a;
    float b;
    scanf("%lld%f",&a,&b);
    b=b*100;
    b+=0.001; /* 1. b is still floating 2.Can use round(b) also*/
    // cout<<b<<"\n";
    int b_=b;
    LL ans=a*b_;
    ans/=100;
    printf("%lld",ans);
}
// 9899901000000100

Measured memory_bytes: 3772
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include <intrin.h>

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

inline void solve() {
	double a, b, h, m;
	cin >> a >> b >> h >> m;

	double an = 360 * ((h / 12 + m / 720) - (m / 60));
	if (an > 180) {
		an = 360 * (-(h / 12 + m / 720) + (m / 60));
	}
	an *= pi / 180;

	double otv = sqrt(a * a + b * b - 2 * a * b * cos(an));
	cout << fixed << setprecision(10) << otv;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << '\n';
	}
}

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

int main(){
    
    int N;
    string A,B,C;
    cin >> N;
    cin >> A >> B >> C;
    int ans = 0;
    for(int i = 0; i < N;i++){
        
        if(A[i] == B[i] && B[i] != C[i] && C[i] != A[i])ans++;
        else if(A[i] != B[i] && B[i] == C[i] && C[i] != A[i])ans++;
        else if(A[i] != B[i] && B[i] != C[i] && C[i] == A[i])ans++;
        else if(A[i] != B[i] && B[i] != C[i] && C[i] != A[i])ans+=2;
    }
    cout << ans << endl;
    
    
}
    
    



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 REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	string s, t; cin >> s >> t;
	string ans = "Yes";
	REP(i,s.size()){
		if (s[i]!=t[i]) ans = "No";
	}
	if (s.size()+1!=t.size()) ans = "No";
	cout << ans << endl;
}

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

const int MAX = 510000;
const ll MOD = 1000000007;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


long long fac[MAX], finv[MAX], inv[MAX];


// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nCkを求める。ただし、n>=10^7のときに使う。
long C(int N,int K)
{
	long x=1,y=1;
	for(int i=1;i<=K;i++)
	{
		x=x*(N-i+1)%MOD;
		y=y*i%MOD;
	}
	return x*modpow(y,MOD-2,MOD)%MOD;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    COMinit();
    ll ans;
    ans = modpow(2, n, MOD);
    ans--;
    ans -= C(n, a);
    ans %= MOD;
    ans -= C(n, b);
    ans %= MOD;
    if (ans < 0) cout << ans + MOD << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 12160
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.Array.Unboxed
import Data.Array.ST
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Char
import qualified Data.Map.Strict as M

main :: IO ()
main = do
    getLine
    xs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let solve :: Int -> [Int] -> [Int] -> Int
        solve count [] _ = count
        solve count _ [] = count
        solve count (x:xs) (y:ys) 
            | x == y = let (x1,x2) = span (== x) (x:xs); (y1,y2) = span (== y) (y:ys) in solve (count+(length x1)*(length y1)) x2 y2
            | x > y  = solve count xs (y:ys)
            | x < y  = solve count (x:xs) ys
    print $ solve 0 (sortBy (\j k -> compare k j) (zipWith (+) [0,1..] xs)) (sortBy (\j k -> compare k j) (zipWith (-) [0,1..] xs))

Measured memory_bytes: 61956
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

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

int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	vector<int> l(n,a[0]),r(n,a[n-1]);
	for(int i = 1; i < n; i++){
		l[i] = gcd(a[i],l[i-1]);
	}
	for(int i = n-2; i >= 0; i--){
		r[i] = gcd(a[i],r[i+1]);
	}

	int ans = r[1];
	for(int i = 1; i < n-1; i++){
		ans = max(ans,gcd(l[i-1],r[i+1]));
	} 
	ans = max(ans,l[n-2]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
Scanf.scanf " %d %d" @@ fun x y -> List.fold_left (fun m (x, y, b) -> min m @@ if x <= y then y - x + b else m) max_int [x, y, 0; -x, y, 1; x, -y, 1; -x, -y, 2] |> Printf.printf "%d\n"

Measured memory_bytes: 384
class UnionFind:
    """素集合を木構造として管理する"""
    def __init__(self, n):
        self.parent = [-1] * n
        self.cnt = n

    def root(self, x):
        """頂点xの根を求める"""
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
 
    def merge(self, x, y):
        """頂点xを含む集合と頂点y含む集合を結合する"""
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.parent[x] > self.parent[y]:
            x, y = y, x
        self.parent[x] += self.parent[y]
        self.parent[y] = x
        self.cnt -= 1

    def is_same(self, x, y):
        """頂点xと頂点yが同じ集合に属するかどうかを返す"""
        return self.root(x) == self.root(y)

    def get_size(self, x):
        """頂点xを含む集合の要素数を返す"""
        return -self.parent[self.root(x)]

    def get_cnt(self):
        """集合の個数を返す"""
        return self.cnt

    
n, m = list(map(int,input().split()))
info = [list(map(int, input().split())) for i in range(m)]

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

for i in reversed(range(m)):
    x, y = info[i]
    x -= 1
    y -= 1
    if uf.is_same(x, y):
        ans[i] = ans[i + 1]
    else:
        ans[i] = ans[i + 1] - uf.get_size(x) * uf.get_size(y)
        uf.merge(x, y)

for res in ans[1:]:
    print(res)

Measured memory_bytes: 108380
import heapq
N,M=map(int,input().split())
A =  [-int(x) for x in input().split()]
A.sort()
for i in range(M):
    rem=A[0]
    heapq.heappush(A,int(rem/2))
    heapq.heappop(A)
    
print(-sum(A))

Measured memory_bytes: 63984
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int diff[N];
    for(int i=0; i<N; i++){
        cin >> diff[i];
    }
    sort(diff,diff+N);
    cout << diff[N/2] - diff[(N/2)-1];
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

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

int digit(char* x) {
	int digit;
	rep(i, 0, 102) {
		if (x[i] == '\0') {
			digit = i;
			break;
		}
	}
	return digit;
}
int main() {
	char A[102], B[102]; cin >> A >> B;

	int A_D = digit(A);
	int B_D = digit(B);

	if (A_D != B_D) {
		if (A_D > B_D) {
			cout << "GREATER" << endl;
		}
		else {
			cout << "LESS" << endl;
		}
		return 0;
	}
	else {
		rep(i, 0, 102) {
			if (A[i] == '\0') {
				break;
			}
			if (A[i] == B[i])
			{
				continue;
			}
			else {
				if (A[i] > B[i]) {
					cout << "GREATER" << endl;
					return 0;
				}
				else {
					cout << "LESS" << endl;
					return 0;
				}
			}
		}
	}
	cout << "EQUAL" << endl;
	return 0;
}

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

using namespace std;
const int dx[] = { -1,0,1,0 };
const int dy[] = { 0,-1,0,1 };
const int ddx[] = { 0,1,1,  0,2, 1,-1,-2, 2, 2, -2,-2,1,-1,1,-1,2,2,-2,-2 };
const int ddy[] = { 2,1,-1,-2,0, 1, 1, 0,2, -2,  2,-2,2,2, -2,-2, 1,-1,1,-1 };

struct dat {
	int d, r, c;
};

int main() {
	int H, W;
	cin >> H >> W;
	int ch, cw, dh, dw;
	cin >> ch >> cw >> dh >> dw;
	ch--; cw--; dh--; dw--;
	vector<string> S(H);
	for (int n = 0; n < H; ++n) {
		cin >> S[n];
	}

	vector<vector<int>> D(H, vector<int>(W, 1e9));//回数
	auto c = [](dat a, dat b) {
		return a.d > b.d;
	};
	priority_queue<dat, vector<dat>, decltype(c)> q(c);
	q.push({ 0, ch, cw });
	D[ch][cw] = 0;

	while (!q.empty()) {
		int x = q.top().r;
		int y = q.top().c;
		int z = q.top().d;
		q.pop();
		if (D[x][y] < z) continue;
		if (x == dh && y == dw) continue;
		//範囲内かつ0を4セット
		for (int l = 0; l < 4; ++l) {
			int x1 = x + dx[l];
			int y1 = y + dy[l];
			if ((0 <= x1) && (H > x1) && (0 <= y1) && (W > y1) && ('.' == S[x1][y1])) {
				if (D[x1][y1] > D[x][y]) {
					D[x1][y1] = D[x][y];
					q.push({ D[x1][y1], x1, y1 });
				}
			}
		}
		//範囲内かつ0を20セット
		for (int l = 0; l < 20; ++l) {
			int x1 = x + ddx[l];
			int y1 = y + ddy[l];
			if ((0 <= x1) && (H > x1) && (0 <= y1) && (W > y1) && ('.' == S[x1][y1])) {
				if (D[x1][y1] > D[x][y]) {
					D[x1][y1] = D[x][y] + 1;
					q.push({ D[x1][y1], x1, y1 });
				}
			}
		}
	}
	if (1e9 == D[dh][dw]) {
		cout << -1 << endl;
	}
	else {
		cout << D[dh][dw] << endl;
	}
	return 0;
}


Measured memory_bytes: 16200
#include <iostream>
#include <string>

using namespace std;

int main(){
    int  S;
    cin >> S;
    int first = S/100;
    int second = S%100;
    if ((first== 0 || 13<=first) &&(second== 0 || 13<=second)) 
    	cout << "NA" << endl;
    if ((1<=first && first <=12) && (second== 0 || 13<=second)) 
    	cout <<"MMYY" << endl;
    if ((1<=second && second <=12) && (first== 0 || 13<=first)) 
    	cout <<"YYMM" << endl;
    if ((1<=first && first <=12) && (1<=second && second <=12)) 
    	cout << "AMBIGUOUS" << endl;
}

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int nax = 2e5 + 100;

vector<int> g[nax];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
	#endif
	int n;
	cin>>n;
	vector<int> a(n),f(n+1);
	int ans = 0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i] > n)ans++;
		else f[a[i]]++;
	}
	for(int i=0;i<=n;i++){
		if(f[i] >= i)ans += f[i] - i;
		else ans += f[i];
	}
	cout << ans << '\n';
}

Measured memory_bytes: 5760
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res
 
def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
 
 
 
        
def main(): #startline--------------------------------------------
    n = int(input())
    p = list(map(float,input().split()))
    dp = [[0]*(n+1) for i in range(n+1)]
    #dp[i][j]...i枚のコインを投げたときに表がj枚でる確率
    dp[0][0] = 1
    for i in range(n):
        for j in range(i+1):
            dp[i+1][j+1] += dp[i][j]*p[i]
            dp[i+1][j] += dp[i][j]*(1 - p[i])
 
    ans = 0
    for i in range((n+1)//2,n+1):
        ans += dp[n][i]
    print(ans)
 
if __name__ == "__main__":
    main() #endline==============================================

Measured memory_bytes: 261356
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
int a,b,c;
int main() {
	read(a),read(b),read(c);
	puts(a+b>=c?"Yes":"No");
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;
const int mod = 1000000007;

signed main() {
    int H, W, K;
    cin >> H >> W >> K;
    int dp[101][8] = {};
    dp[0][0] = 1;
    for (int h = 0; h < H; ++h) {
        for (int x = 0; x < W; ++x) {
            for (int b = 0; b < 1 << (W - 1); b++) {
                bool ok = true;
                // check validation
                for (int i = 0; i < W - 2; i++) {
                    if (((b >> i) & 1) && (b >> (i + 1) & 1)) {
                        ok = false;
                    }
                }

                if (ok) {
                    if (x >= 1 && ((b >> (x - 1)) & 1)) { // x => x - 1
                        dp[h + 1][x - 1] = (dp[h + 1][x - 1] + dp[h][x]) % mod;
                    } else if ( x <= W - 2 && ((b >> x) & 1)) { // x => x + 1
                        dp[h + 1][x + 1] = (dp[h + 1][x + 1] + dp[h][x]) % mod;
                    } else {
                        dp[h + 1][x]  = (dp[h + 1][x] + dp[h][x]) % mod;
                    }
                }
            }
        }
    }
    cout << dp[H][K - 1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
typedef long long ll;
typedef double db;
typedef vector<ll> ve;
typedef pair<int, int> pa;
typedef vector<pair<int,int> > vepa;
typedef map<int, int> mp;
const ll N=1e6+5;
ll arr[N],A[N],ARR[N]  ;
bool visited[N]={};
ll cnt[N]={};
bool f;
int main()
{

string s;
int64_t k;
cin>>s>>k;
 rep(i,k)
 {
     if(s[i]-49)
     {
         cout<<s[i];
         go;
     }
 }
puts("1");
go;
}


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  char s[105];
  scanf("%s", s);
  int n = strlen(s);
  for (int i=0; i<n; i++) printf("x");
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e16;
using Graph = vector<vector<int>>;

signed main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  Graph G(N);
  map<pair<int, int>, int> hen;
  for( int i = 0; i < N-1; i++ ){
    int A, B, C;
    cin >> A >> B >> C;
    A--;
    B--;
    G.at(A).push_back(B);
    G.at(B).push_back(A);
    hen[make_pair(A, B)] = C;
    hen[make_pair(B, A)] = C;
  }
  
  //頂点0からの距離が偶数なら0、奇数なら1
  vector<int> ans(N, 0);
  
  //BFS
  vector<int> dist(N, -1);
  queue<int> que;
  dist.at(0) = 0;
  que.push(0);
  
  while( !que.empty() ){
    int v = que.front();
    que.pop();
    
    for( int nv : G.at(v) ){
      if( dist.at(nv) != -1 ) continue;
      dist.at(nv) = dist.at(v) + hen.at(make_pair(v, nv));
      if( dist.at(nv) % 2 == 1 ) ans.at(nv) = 1;
      que.push(nv);
    }
  }
  
  for( int i = 0; i < N; i++ ) cout << ans.at(i) << endl;
  
}


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

int main() {
  ll N; cin >> N;
  set<string> ss;
  string s[N];
  bool ok = true;
  for (ll i = 0; i < N; i++) {
    cin >> s[i];
    if (ss.count(s[i])!=0) {ok = false;}
    ss.insert(s[i]);
  }
  for (ll i = 1; i < N; i++) {
    ll x = s[i-1].size();
    if (s[i-1][x-1] != s[i][0]) {ok = false;}
  }
  if (ok) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

Measured memory_bytes: 768
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();
    int l = (int) ((int) N / 1.08);

    if (N == Math.floor(l * 1.08)) {
      System.out.println(l);
    } else if (N == Math.floor((l + 1) * 1.08)) {
      System.out.println((l + 1));
    } else {
      System.out.println(":(");
    }

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

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

int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    string s;
    int x,y;
    x=tx-sx;
    y=ty-sy;
    rep(i,x){
        s=s+'R';
    }

    rep(i,y){
        s=s+'U';
    }

    rep(i,x){
        s=s+'L';
    }

    rep(i,y){
        s=s+'D';
    }

    s=s+'D';

    rep(i,x+1){
        s=s+'R';
    }

    rep(i,y+1){
        s=s+'U';
    }

    s=s+'L';

    s=s+'U';

    rep(i,x+1){
        s=s+'L';
    }

    rep(i,y+1){
        s=s+'D';
    }

    s=s+'R';











    cout << s << endl;

    
    

    return 0;
}

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

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

int main() {
  int n,m;
  cin >> n >> m;
  int s[m][n+1];
  rep(i,m) {
    cin >> s[i][0];
    rep(j,s[i][0]) {
      cin >> s[i][j+1];
      s[i][j+1]--;
    }
  }

  int p[m];
  rep(i,m) cin >> p[i];

  int ans = 0;
  rep(i,1<<n) {
    bool flag = true;
    rep(j,m) {
      int cnt = 0;
      rep(k,s[j][0]) {
        if (i>>s[j][k+1]&1) cnt++;  // i番目のビットが1となっているか
      }
      if (cnt%2 != p[j]) flag = false;
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608