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

typedef int ll;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define fori(i, n) forifrom(i, 0, n)

// ------------------------------------------------------------------

const ll maxn = 100010;

ll n, notsat[maxn];
vector<ll> g[maxn];

void dfs(ll x, ll par) {
    notsat[x] = 1;
    for (auto y : g[x]) if (y != par) {
        dfs(y, x);
        if (notsat[y]) {
            if (notsat[x]) notsat[x] = 0;
            else {
                cout << "First\n";
                exit(0);
            }
        }
    }
}

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

    cin >> n;
    fori (i, n - 1) {
        ll a, b; cin >> a >> b; --a, --b;
        g[a].emplace_back(b), g[b].emplace_back(a);
    }
    dfs(0, 0);
    if (notsat[0]) cout << "First\n";
    else cout << "Second\n";

}


Measured memory_bytes: 9524
#include<iostream>

using namespace std;

int main() {
	int N;	cin >> N;
	int A, B;
	int answer;

	int sumA;
	int sumB;

	for (int i = 1; i <= N / 2; ++i) {
		A = i;
		B = N - i;
		sumA = 0;
		sumB = 0;

		while (A) {
			sumA += (A % 10);
			A /= 10;
		}
		while (B) {
			sumA += (B % 10);
			B /= 10;
		}
		if (i == 1) {
			answer = sumA + sumB;
		}

		if (answer > sumA + sumB) {
			answer = sumA + sumB;
		}
	}

	cout << answer << endl;

	return 0;
}

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

const long long BN = 1024 * 1024;

int main()
{
	
	long long N, A, B;
	long long X[BN];
	
	cin>>N>>A>>B;
	for(int i = 0; i < N; i++)
		cin>>X[i];
		
	long long ans = 0;
	for(int i = 0; i < N - 1; i++)
	{
		if(A * (X[i + 1] - X[i]) < B)
			ans += A * (X[i + 1] - X[i]);
		else
			ans += B;
	}
	
	cout<<ans<<endl;
	//system("PAUSE");
	return 0;	
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n,m;
    cin>>n>>m;
    char a[n+2][m+2];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i+1][j+1];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(a[i+1][j+1]=='#'){
                bool cannot=true;
                //if(a[i][j]=='#') cannot=false;
                if(a[i][j+1]=='#') cannot=false;
                //if(a[i][j+2]=='#') cannot=false;
                if(a[i+1][j]=='#') cannot=false;
                if(a[i+1][j+2]=='#') cannot=false;
                if(a[i+2][j+1]=='#') cannot=false;
               // if(a[i+2][j]=='#') cannot=false;
                //if(a[i+2][j+2]=='#') cannot=false;
                if(cannot){
                    cout<<"No"<<endl; return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i ++){
        cin >> a.at(i);
    }

    vector<int> c(9);

    for(int i = 0;i < n;i ++){
        if(a.at(i) > 3199) c.at(8) ++;
        else c.at(a.at(i)/400) ++;
    }

    int ans = 0;
    for(int i = 0;i < 8;i ++){
        if(c.at(i)) ans ++;
    }

    cout << max(ans,(int)1) << " " << ans+c.at(8) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N, K;
    cin >> N >> K;
    cout << N - K + 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string.h>
using namespace std;
int main(void){
    // Here your code !
    int h,w,i,count=0,count2=0;
    bool flag=true;
    char x;
    cin>>h>>w;
    int alpha[26];
    memset(alpha,0,sizeof(int)*26);
    
    for(i=0;i<h*w;i++){
        cin>>x;
        alpha[x-'a']++;
    }
    
    if(h%2==0&&w%2==0){
        for(i=0;i<26;i++){
            if(alpha[i]%4)flag=false;
        }
    }
    
    if(h%2==0&&w%2==1){
        for(i=0;i<26;i++){
            if(alpha[i]%4==2)count++;
            if(alpha[i]%2)flag=false;
        }
        if(count>h/2)flag=false;
    }
    
    if(h%2==1&&w%2==0){
        for(i=0;i<26;i++){
            if(alpha[i]%4==2)count++;
            if(alpha[i]%2)flag=false;
        }
        if(count>w/2)flag=false;
    }
    
    if(h%2==1&&w%2==1){
        for(i=0;i<26;i++){
            if(alpha[i]%4)count++;
            if(alpha[i]%2)count2++;
        }
        if(count>(w+h)/2||count2>1)flag=false;
    }
    
    if(flag){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
    int x,i;
    for(i = 1;; ++i) {
        scanf("%d",&x);
        if(x == 0) {
            break;
            printf("Case %d: %d\n",i,x);
        }
        else {
            printf("Case %d: %d\n",i,x);
        }
    }
    return 0;
}


Measured memory_bytes: 2688
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[101];
    for (int i = 0; i < N; i++) {
      int number = sc.nextInt();
      d[number]++;
    }
    int count = 0;
    for (int i = 1; i <= 100; i++) {
      if (d[i] > 0) {
        count++;
      }
    }
    System.out.println(count);
  }
}

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

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

  int answer = 1;

  for (int b = 2; b <= X; b++) {
    int bp = b * b;

    for (int i = 0; bp <= X; bp *= b) {
      answer = max(answer, bp);
    }
  }

  cout << answer << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define REP(i, n) for(int (i) = 0; (i < (int)(n)); (i)++)
int main(){
    vector<int> v;
    map<int, int> m;
    int n; cin >> n;
    REP(i, n){
        int a; cin >> a;
        m[a]++;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    ll ans = 0; 
    REP(i, n){
        ll a = v[i];
        if(m[a] != 0){
            ll b = 1;
            while(b < a){
                b *= 2;
            }
            if(b == a){
                if(m[a] >= 2){
                    m[a] -= 2;
                    ans++;
                }
            } else {
                ll c = b -a;
                if(m[c] != 0){
                    m[a]--;
                    m[c]--;
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  vector<int> res;
  while (a.size()) {
    int sv = -1;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == i + 1) {
        sv = i;
      }
    }
    if (sv == -1) {
      cout << -1 << '\n';
      return;
    }
    res.push_back(a[sv]);
    a.erase(a.begin() + sv);
  }
  reverse(all(res));
  for (auto &i : res) cout << i << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(){int a[3]={1,0,0},b;char c[3];
while(std::cin>>c){b=a[(c[0]-'A')];a[c[0]-'A']=a[(c[2]-'A')];a[(c[2]-'A')]=b;}
for(b=0;b<3;b++)if(a[b])std::cout<<(char)('A'+b)<<"\n";}

Measured memory_bytes: 0
import java.util.*;
public class Main { //atcoder ABC128C -

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int n = seer.nextInt();
		int m = seer.nextInt();
		ArrayList<Integer>[] bs = new ArrayList[m];
		for(int i = 0; i < m; i++){
			int k = seer.nextInt();
			bs[i] = new ArrayList<>();
			for(int j = 0; j < k; j++){
				bs[i].add(seer.nextInt()-1);
			}
		}
		int[] ps = new int[m];
		for(int i = 0; i < m; i++){
			ps[i] = seer.nextInt();
		}
		int res = 0;
		for(int mask = 0; mask < (1 << n); mask++){
			boolean add = true;
			for(int i = 0; i < m; i++){
				int comp = 0;
				for(int k: bs[i]){
					if((mask & (1 << k)) > 0){
						comp++;
					}
				}
				if(comp % 2 != ps[i]){
					add = false;
				}
			}
			if(add) res++;
		}
		System.out.println(res);
	}
}


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

int main() {
  int A,B;
  cin >> A >> B;
  int sum = 0;
  for (int N = A ; N <= B ; N++){
    int a,b,c,d;
    a = N/10000;
    b = N%10000/1000;
    c = N%10000%1000%100/10;
    d = N%10000%1000%100%10;
    if ( a == d && b == c ) sum++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[100];
	int n;
	int i;
	int search_no;
	int index_min;
	int index;
	int index_max;
	int count;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		scanf("%d", &search_no);
		
		index_min = 0;
		index_max = n - 1;
		index = (index_min + index_max) / 2;
		
		count = 0;
		while(1){
			count++;
			
			if (a[index] == search_no){
				break;
			}
			
			if (a[index] < search_no){
				index_min = index + 1;
			}
			else if (a[index] > search_no){
				index_max = index - 1;
			}
			
			index = (index_min + index_max) / 2;
			
			if (index_min > index_max){
				break;
			}
		}
		
		printf("%d\n", count);
	}
	
	return (0);
}

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

int main(){
	string s,r="yuiophjklnm";
	int a,b,c;
	while(cin>>s,s[0]!='#'){
		a=-1;
		c=0;
		for(int i=0;i<s.size();i++){
			b=r.find(s[i],0)==string::npos;
			c+=a!=b;
			a=b;
		}
		cout<<c-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define ll long long
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b;
    cin >> a >> b;
    int ans = stoi(a+b);
    for(int i=0;i<ans;i++){
        if(i*i==ans){
            cout << "Yes" << endl;
            return 0;
        }
        else continue;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))

def main():
  n,x = readInts()
  A = readInts()
  ans = 0
  i = 0
  if sum(A[i:i+2]) > x:
    sum_ = sum(A[i:i+2])
    # preprocessing
    
    if A[i+1] - (sum_ - x) < 0:
      A[i+1] = 0
      ans += A[i+1]
      nya = sum_ - x
      A[i] -= nya
      ans += nya
    else:
      nya = sum_ - x
      A[i+1] -= nya
      ans += nya
      
  for i in range(1,n-1):
    if sum(A[i:i+2]) > x:
      sum_ = sum(A[i:i+2])
      nya = sum_ - x
      A[i+1] -=nya
      ans += nya
  print(ans)
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14276
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [long(input_raw[0]), long(input_raw[1])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(long(input_raw[i]))

    max_x = 0L
    for i in range(41):
        mask = 0x01 << i
        one_count = 0
        for j in range(len(A)):
            one_count += 1 if (A[j] &  mask ) > 0 else 0
        if one_count <= N/2:
            max_x += (0x01 << i)

    x = 0L
    flag = False
    for i in range(40, -1, -1):
        mask = 0x01 << i
        if K & mask != 0 & flag == False:
            if (max_x & mask) == 0:
                flag = True
            else:
                x += (max_x & mask)
        elif flag == True:
            x += (max_x & mask)

    fx = 0L
    for i in range(len(A)):
        fx += (x ^ A[i])

    print fx






if __name__ == '__main__':
    main()


Measured memory_bytes: 18632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;//"12"
  cin>>N;
  int sum=0;
  
  for(int i=0; i<N.length() ;i++){
    sum += stoi( N.substr(i,1) );//////////////////////////////////!?!?!?!?
  }
  //cout<<sum<<endl;
  
  if(stoi(N)%sum==0){///////////string→int
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() 
{
	unsigned int n, i;
	string x, y;
	double sum = 0;

	// input
	cin >> n;
	for (i=0; i<n; i++) {
		cin >> x;
		cin >> y;
		// calc
		if (y == "BTC") {
			sum += (380000.0 * std::stod(x));
		}else {
			sum += std::stol(x);
		}
	}

	// output
	cout << sum;
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
a,b,c = readInts()
print((a*b)//2)


Measured memory_bytes: 10204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=30;
int a[maxn][10],kt[30];
int main()
{
	int n,tt;
	scanf("%d%d",&n,&tt);
	
	if(n<3) 
	{
		cout<<0<<endl;
		return 0;
	}
	
	for(int i=1;i<=20;i++)
	for(int j=1;j<=7;j++)
	a[i][j]=((i-1)%11*7%11+j)%11;
	
	
	for(int ii=3;ii<=20;ii++)
	{
		int num=0;
		for(int j=1;j<=5;j++)
		{
			int tmp=0;
			for(int i=ii-2;i<=ii;i++)
			for(int k=j;k<=j+2;k++)
			{
				tmp+=a[i][k];
			}
			if(tmp%11==tt)
			{
				num++;
			}
		}
		kt[ii]=num;
	}
	
	n-=2;
	ll sum=0;
	for(int i=3;i<=13;i++)
	sum+=(ll)kt[i];
	
	sum*=(ll)n/11;
	for(int i=1;i<=n%11;i++)
	sum+=(ll)kt[2+i];
	
	cout<<sum<<endl;

	return 0;;;;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    char ch;
    while(1) {
        scanf( "%c", &ch );
        if( ch == '\n' ) break;
        if( 'a' <= ch && ch <= 'z' ){
            printf( "%c", ch-32 );
        } else if( 'A' <= ch && ch <= 'Z' ) {
            printf( "%c", ch+32 );
        } else {
            printf( "%c", ch );
        }
    }
    printf( "\n" );
    return 0;
}


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

void addmod(ll& a,ll b){
	a+=b;
	if(abs(a)>=mod)a%=mod;
}

ll llcrossmod(ll a,ll b){
	ll ret=a;
	ret=ret*b;
	if(abs(ret)>=mod)ret%=mod;
	return ret;
}

ll lladdmod(ll a,ll b){
	ll ret=a;
	ret+=b;
	if(abs(ret)>=mod)ret%=mod;
	return ret;
}

int main(){
	ll n,m;cin>>n>>m;
	ll x[n],y[m];
	for(ll a=0;a<n;++a)cin>>x[a];
	for(ll a=0;a<m;++a)cin>>y[a];
	ll sumx=0;
	ll sumy=0;
	for(ll a=0;a<n;++a){
		ll b,c,d;
		b=llcrossmod(x[a],a);
		c=llcrossmod(-x[a],(n-1-a));
		d=lladdmod(b,c);
		addmod(sumx,d);
	}
	for(ll a=0;a<m;++a){
		ll b,c,d;
		b=llcrossmod(y[a],a);
		c=llcrossmod(-y[a],(m-1-a));
		d=lladdmod(b,c);
		addmod(sumy,d);
	}
	ll ret=llcrossmod(sumx,sumy);
	addmod(ret,mod);
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<map>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
inline ll read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
#define d read()
ll n;
ll now=100;
int main(){
	scanf("%lld",&n);
	ll k=1;
	while(1){
		now=(ll)((double)now)*1.01;
		if(now>=n){cout<<k;break;}
		k++;
	}
	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  int n;
  cin >> n;
  if (n == 1)
	cout << 1 << endl;

  for (int i = 0; i < n; i++) {
	if (n < pow(2, i)) {
	  cout << pow(2, i - 1) << endl;
	  return 0;
	}
  }
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    string s;
    cin>>s;
    int fl=0,up=0,c=0;
    if(s[0]=='A')
    {
        for(int i=1;i<SZ(s);i++)
        {
           if(s[i]>='A'&&s[i]<='Z')
           {
               up++;
           }
           if(s[i]=='C'&&i>=2&&i<=(SZ(s)-2))
           {
               c++;
           }
        }
        if(up!=1||c!=1)
        {
            cout<<"WA"<<nl;
        }
        else
        {
            cout<<"AC"<<nl;
        }
    }
    else
    {
        cout<<"WA"<<nl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<iostream>
#include<set>
#include<map>
#define re register
#define ll long long
using namespace std;
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9'|| ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return sum*f;
}
const double eps=1e-10,Pi=acos(-1.0);
struct node{
	double x,y;
	node operator+(node b){return (node){x+b.x,y+b.y};}
	node operator-(node b){return (node){x-b.x,y-b.y};}
	node operator*(double b){return (node){x*b,y*b};}
	double len(){return sqrt(x*x+y*y);}
};
int fh(double a){return fabs(a)<eps?0:a>eps?1:-1;}
double cross(node a,node b){return a.x*b.y-a.y*b.x;}
double dot(node a,node b){return a.x*b.x+a.y*b.y;}
node projection(node p1,node p2,node p){node v=p2-p1;return p1+v*(dot(v,p-p1)/dot(v,v));}
node reflection(node p1,node p2,node p){node P=projection(p1,p2,p);P=P*2-p;return P;}
void Counter_Clockwise(node p1,node p2,node p){
	if(cross(p2-p1,p-p1)>eps){puts("COUNTER_CLOCKWISE");return;}
	if(cross(p2-p1,p-p1)<-eps){puts("CLOCKWISE");return;}
	if(dot(p2-p1,p-p1)<-eps){puts("ONLINE_BACK");return;}
	if(dot(p2-p1,p2-p1)>=dot(p-p1,p2-p1)){puts("ON_SEGMENT");return;}
	puts("ONLINE_FRONT");
}
bool insegment(node A,node B,node p){
	if(fh(cross(B-A,p-A)))return false;
	return ((fh(p.x-A.x)>=0 && fh(B.x-p.x)>=0) || (fh(p.x-A.x)<=0 && fh(B.x-p.x)<=0)) && ((fh(p.y-A.y)>=0 && fh(B.y-p.y)>=0) || (fh(p.y-A.y)<=0 && fh(B.y-p.y)<=0));
}
int parallel(node A1,node A2,node B1,node B2){
	if(!fh(cross(B2-B1,A2-A1)))return 2;
	if(!fh(dot(B2-B1,A2-A1)))return 1;
	return 0;
}
bool intersection(node A1,node A2,node B1,node B2){
	if(!fh(cross(B2-B1,A2-A1))){
		if(insegment(A1,A2,B1) || insegment(A1,A2,B2) || insegment(B1,B2,A1) || insegment(B1,B2,A2))return true;
		return false;
	}
	return fh(cross(A1-B1,B2-B1)*cross(A2-B1,B2-B1))<=0 && (fh(cross(B1-A1,A2-A1)*cross(B2-A1,A2-A1))<=0);
}
node getintersection(node A1,node A2,node B1,node B2){
	node v=A2-A1;
	return A1+v*(cross(B2-B1,B1-A1)/cross(B2-B1,A2-A1));
}
double distance(node A1,node A2,node B1,node B2){
	if(intersection(A1,A2,B1,B2))return 0.0;
	node p;double ans=1e18;
	ans=min(ans,(A1-B1).len());ans=min(ans,(A1-B2).len());ans=min(ans,(A2-B1).len());ans=min(ans,(A2-B2).len());
	p=projection(A1,A2,B1);
	if(insegment(A1,A2,p))ans=min(ans,(B1-p).len());
	p=projection(A1,A2,B2);
	if(insegment(A1,A2,p))ans=min(ans,(B2-p).len());
	p=projection(B1,B2,A1);
	if(insegment(B1,B2,p))ans=min(ans,(A1-p).len());
	p=projection(B1,B2,A2);
	if(insegment(B1,B2,p))ans=min(ans,(A2-p).len());
	return ans;
}
double area(node *p,int n){
	double area=0;
	for(int i=1;i<n;i++)area+=cross(p[i]-p[1],p[i+1]-p[1]);
	area+=cross(p[n]-p[1],p[1]-p[1]);
	return area*0.5;
}
node p[110];
int main(){
	int n=gi();
	for(int i=1;i<=n;i++)p[i].x=gi(),p[i].y=gi();
	printf("%.1lf\n",area(p,n));
	return 0;
}




Measured memory_bytes: 3232
/*input
10 1000000000000000000
0 0 1 1 0 0 0 1 1 0
0 0 0 0 0 1 1 1 0 0
0 1 0 0 0 1 0 1 0 1
1 1 1 0 1 1 0 1 1 0
0 1 1 1 0 1 0 1 1 1
0 0 0 1 0 0 1 0 1 0
0 0 0 1 1 0 0 1 0 1
1 0 0 0 1 0 1 0 0 0
0 0 0 0 0 1 0 0 0 0
1 0 1 1 1 0 1 1 1 0
*/
/*

**************************
*						 *
* AUTHOR :: shado_w      *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  55
const lld M2=hell;
lld a[N][N];
lld ans[N][N];
lld c[N];
void inii_mat(){
	rep(i,0,N){
		ans[i][i]=1;
	}
}
void mulansb(){
	lld c[N][N];
	rep(i,0,N){
		rep(j,0,N){
			c[i][j]=0;
		}
	}
	rep(i,0,N){
		rep(j,0,N){
			rep(k,0,N){
				c[i][j]+=(ans[i][k]*a[k][j])%M2;
				c[i][j]%=M2;
			}
		}
	}
	rep(i,0,N){
		rep(j,0,N){
			ans[i][j]=c[i][j]%M2;
		}
	}
}
void mulaa(){
	lld c[N][N];
	rep(i,0,N){
		rep(j,0,N){
			c[i][j]=0;
		}
	}
	rep(i,0,N){
		rep(j,0,N){
			rep(k,0,N){
				c[i][j]+=(a[i][k]*a[k][j])%M2;
				c[i][j]%=M2;
			}
		}
	}
	rep(i,0,N){
		rep(j,0,N){
			a[i][j]=c[i][j]%M2;
		}
	}
}
void powerr(lld k){
	while(k!=0){
		if(k&1){
			mulansb();
		}
		k/=2;
		mulaa();
	}
}
void solve()
{
	inii_mat();
	lld n,k;
	cin >> n >> k;
	rep(i,0,n){
		rep(j,0,n){
			cin >> a[i][j] ;
		}
	}
	powerr(k);
	lld res=0;
	rep(i,0,n){
		rep(j,0,n){
			res=(res+ans[i][j])%M2;
		}
	}
	cout << res << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 3732
object Main extends App {
  val input = io.StdIn.readLine()
  val score = input match {
    case "RRR" => 3
    case "RRS" => 2
    case "RSR" => 1
    case "RSS" => 1
    case "SRR" => 2
    case "SRS" => 1
    case "SSR" => 1
    case "SSS" => 0
  }
  println(score)
}

Measured memory_bytes: 54584
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=100005;

int n,m,tot,ans[N],c[N];
struct data{int x,y,l,r,id,c;}a[N*3],q[N*50];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

bool cmp(data a,data b)
{
	return a.x<b.x;
}

void ins(int x,int y)
{
	while (x<=m) c[x]+=y,x+=x&(-x);
}

int query(int x)
{
	int ans=0;
	while (x) ans+=c[x],x-=x&(-x);
	return ans;
}

int main()
{
	n=read();m=read();
	for (int i=1;i<=n;i++) a[i].x=read(),a[i].y=read();
	sort(a+1,a+n+1,cmp);
	for (int i=2;i<=m;i++)
	{
		for (int j=i;j<=m;j+=i)
		{
			q[++tot].x=j-i;q[tot].l=j-i+1;q[tot].r=j-1;q[tot].id=i;q[tot].c=1;
			q[++tot].x=j-1;q[tot].l=j-i+1;q[tot].r=j-1;q[tot].id=i;q[tot].c=-1;
		}
		int x=(m/i)*i;
		q[++tot].x=x;q[tot].l=x+1;q[tot].r=m;q[tot].id=i;q[tot].c=1;
		q[++tot].x=m;q[tot].l=x+1;q[tot].r=m;q[tot].id=i;q[tot].c=-1;
	}
	sort(q+1,q+tot+1,cmp);
	for (int i=1;i<=m;i++) ans[i]=n;
	int now=1;
	for (int i=1;i<=tot;i++)
	{
		while (now<=n&&a[now].x<=q[i].x) ins(a[now].y,1),now++;
		ans[q[i].id]+=q[i].c*(query(q[i].r)-query(q[i].l-1));
	}
	for (int i=1;i<=m;i++) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 64512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long ll;
#define ALL(V) V.begin(), V.end()
#define RALL(V) V.rbegin(), V.rend()
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}


ll Main(ll H)
{
    ll ans = 1LL;
    int N = 0;
    while(H > 0) {
        H >>= 1;
        N++;
    }
    ll doubles = 1LL;
    REP2(i, 1, N) {
        doubles *= 2;
        ans += doubles;
    } 
    return ans;
}

int main(void){
    ll H;
    cin >> H;
    cout << Main(H) << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];

    sort(a.begin(), a.end(), greater<>());
    int cnt = 0, alice = 0, bob = 0;
    while(cnt < N){
        alice += a[cnt];
        cnt++;
        if (cnt == N) break;
        bob += a[cnt];
        cnt++;
    }

    cout << alice - bob << endl;
    }

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll a, b, c, d; cin >> a >> b >> c >> d;
  fin(max(a*b, c*d))
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		
		typedef long long ll;
		#define pi 3.14159265 
		#define EPS 1e-8
		
		#define mod 1000000007
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"

		const ll INF=(ll)2e18;
		
		long long binpow(long long a, long long b, long long m) {
		a %= m;
		long long res = 1;
		while (b > 0) {
			if (b & 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
			 ll fac[100050]={0};

		
		ll modinverse(ll a, ll m)
		{
			return binpow(a,m-2,m);
		}
		ll ncr(ll n,ll r)
		{
			return (((fac[n]*modinverse(fac[r],mod))%mod )*modinverse(fac[n-r],mod))%mod;
		}
		
		int main()
		{
			 ios_base::sync_with_stdio(false);
			 cin.tie(NULL);
			
			fac[0]=fac[1]=1;
			for(ll i=2;i<=1e5+5;i++)
			{
				fac[i]=fac[i-1]*i;
				fac[i]%=mod;
			}
			ll n;
			cin>>n;
			vector<ll> v(n);
			for(ll i=0;i<n;i++)
			{
				cin>>v[i];
			}
			ll mul=0,ans=0;
			for(ll i=1;i<n;i++)
			{
				mul+=modinverse(i,mod);
				mul%=mod;
				ll ans1=mul;
				ans1*=fac[n-1];
				ans1%=mod;
				ans1*=(v[i]-v[i-1]);
				ans1%=mod;
				ans+=ans1;
				ans%=mod;
				
				//cout<<ans<<endl;
			}
			cout<<ans;
			 
			
		}
						
					 
				 


Measured memory_bytes: 1792
a = [int(i) for i in input().split()]
g = 0
k = 0
count = 0
for i in a:
    if i%2==0:
        g += 1
    else:
        k += 1
if g==1:
    count += 1
    for i in range(3):
        if a[i]%2==1:
            a[i] += 1
            
            
elif k==1:
    count += 1
    for i in range(3):
        if a[i]%2==0:
            a[i] += 1
a = sorted(a)[::-1]
count += (a[0]-a[1])//2 + (a[0]-a[2])//2
print(count)

Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;


int main() {
    int n; cin >> n;
    vector<int> a(n);
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum+=a[i];
    }

    ll ans = 1e16;
    ll b_sum = 0;
    for (int i = 0; i < n; i++)
    {
        b_sum += a[i];
        sum -= a[i];
        ans = min(ans, abs(sum-b_sum));
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

constexpr double EPS = 1e-7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
#define PI (acos(-1))

constexpr int MOD = 1e9 + 7;

vector<tuple<int, string, int>> SP;

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

	int N;
	cin >> N;
	SP.resize(N);

	for (int i = 0; i < N; i++) {
		string S;
		int P;
		cin >> S >> P;
		SP[i] = {i + 1, S, P};
	}

	sort(SP.begin(), SP.end(), [](auto &lhs, auto &rhs) {
		if (get<1>(lhs) != get<1>(rhs)) {
			return get<1>(lhs) < get<1>(rhs);
		} else {
			return get<2>(lhs) > get<2>(rhs);
		}
	});

	for (int i = 0; i < N; i++) {
		cout << get<0>(SP[i]) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;

typedef string::const_iterator State;
class ParseError {};
/*
struct Edge {
int from, to, cost;
bool operator<(Edge e) {
return cost < e.cost;
}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
*/

bool formula(State &begin, map<char, bool> value) {
	//cout << *begin << endl;
	if (*begin == '-') {
		begin++;
		return !formula(begin, value);
	}
	else if (*begin == '(') {
		begin++;
		bool ret = formula(begin, value);
		if (*begin == '*') {
			begin++;
			bool right = formula(begin, value);
			ret = ret && right;
		}
		else if (*begin == '+') {
			begin++;
			bool right = formula(begin, value);
			ret = ret || right;
		}
		else {
			begin += 2;
			bool right = formula(begin, value);
			ret = (!ret) || right;
		}
		begin++;
		return ret;
	}
	else {
		bool ret = value[*begin];
		begin++;
		return ret;
	}
}

bool equation(State &begin, map<char, bool> value) {
	bool lhs = formula(begin, value);
	begin++;
	bool rhs = formula(begin, value);
	/*
	for (auto p : value) {
		cout << p.first << ":" << (p.second ? "T " : "F ");
	}
	cout << endl << (rhs ? "T=" : "F=") << (lhs ? "T" : "F") << endl;
	*/
	return (lhs == rhs);
}

int main(void) {
	while (true) {
		string s;
		getline(cin, s);
		if (s[0] == '#')break;

		bool flag = true;
		map<char, bool>value;
		value['T'] = true;
		value['F'] = false;
		rep(i, (1 << 11)) {
			rep(j, 11) {
				value['a' + j] = ((i&(1 << j)) != 0 ? true : false);
			}

			State begin = s.begin();

			if (!equation(begin, value)) {
				cout << "NO" << endl;
				flag = false;
				break;
			}
		}
		if (flag) {
			cout << "YES" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3936
#include<bits/stdc++.h>
#define int long long
using namespace std;
int INF = 1e10;

signed main() {
    int A,B,C;
    cin >> A >> B >> C;
    if(A == B && B == C && A % 2 == 0) {
        cout << -1 << endl;
    }
    else {
        int ret = 0;
        while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
            int D = A / 2;
            int E = B / 2;
            int F = C / 2;
            A = E + F;
            B = D + F;
            C = D + E;
            ret++;
        }
        cout << ret << endl;
    }
}


Measured memory_bytes: 256
/*Practice hard*/
#include <bits/stdc++.h>
using namespace std;
//_______MACROS_______//
#define   fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define   int   long long int
#define   pb    push_back
#define   f     first
#define   s     second



signed main()
{
    //code
    fast ;
    int t = 1;
	//cin>>t;

	while(t--)
    {

		string s , t ;
		cin >> s >> t ;
		bool flag = true ;
		if (s.size() == t.size() - 1)
        {
            for (int i = 0 ; i < s.size() ; i ++)
            {
                if (s[i] != t[i])
                {
                    flag = false;
                    cout << "No" << endl;
                    break;
                }
            }
            if (flag)
            {
                cout << "Yes" << endl;
            }
        }
        else
        {
            cout << "No" << endl;
        }
    }
	return 0;
}


Measured memory_bytes: 3644
import sys, copy, math, collections, itertools

a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
l=[]
l+=[a1,a2,a3,b1,b2,b3]
d=[0,0,0,0]
for i in l:
    d[i-1]+=1

# 偶数次数
a=len([i for i in d if i%2==0])
if a == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3444
def main():
    n = int(input())
    xyhs = [list(map(int, input().split())) for _ in range(n)]
    for cy in range(0, 101):
        for cx in range(0, 101):
            x0, y0, h0 = next((x, y, h) for x, y, h in xyhs if h > 0)
            ch = h0 + abs(x0 - cx) + abs(y0 - cy)
            res = True
            for x, y, h in xyhs:
                hh = max(ch - abs(x - cx) - abs(y - cy), 0)
                if hh != h:
                    res = False
                    break
            if res:
                print(cx, cy, ch)
                return


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
// Problem : A - Shiritori
// Contest : AtCoder - AtCoder Beginner Contest 060
// URL : https://atcoder.jp/contests/abc060/tasks/abc060_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
string a,b,c;cin>>a>>b>>c;
if(a[size(a)-1]==b[0] and b[size(b)-1]==c[0])
{
	cout<<"YES";
}
else
cout<<"NO";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

using namespace std;

static const int maxN = 10e5 + 3; 

vector<int> fedges[maxN], bedges[maxN], ids(maxN), ans(maxN), size(maxN, 0);
vector<bool> visited(maxN, false);

int id = 0;

void dfs(int node){
    ids[node] = id;
    visited[node] = true;
    size[id]++;
    for(int i = 0; i < fedges[node].size(); i++){
        if(!visited[fedges[node][i]])
            dfs(fedges[node][i]);
    }
}

int main(){
    int n, m, k;

    cin >> n >> m >> k;

    for(int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        u--, v--;
        fedges[u].push_back(v);
        fedges[v].push_back(u);
    }    

    for(int i = 0; i < k; i++){
        int u, v;
        cin >> u >> v;
        u--, v--;
        bedges[u].push_back(v);
        bedges[v].push_back(u);
    }

    for(int i = 0; i < n; i++){
        if(!visited[i]){
            dfs(i);
            id++;
        }
    }

    for(int i = 0; i < n; i++){
        ans[i] = size[ids[i]];
        for(int j = 0; j < fedges[i].size(); j++){
            if(fedges[i][j] < i && ids[i] == ids[fedges[i][j]]){
                ans[i]--, ans[fedges[i][j]]--;
            }
        }
        for(int j = 0; j < bedges[i].size(); j++){
            if(bedges[i][j] < i && ids[i] == ids[bedges[i][j]]){
                ans[i]--, ans[bedges[i][j]]--;
            }
        }
    }

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

Measured memory_bytes: 65920
import sys
for line in sys.stdin:
    if float(line) <= 48.00: print "light fly"
    elif 48.0 < float(line) <= 51.0: print "fly"
    elif 51.0 < float(line) <= 54.0: print "bantam"
    elif 54.0 < float(line) <= 57.0: print "feather"
    elif 57.0 < float(line) <= 60.0: print "light"
    elif 60.0 < float(line) <= 64.0: print "light welter"
    elif 64.0 < float(line) <= 69.0: print "welter"
    elif 69.0 < float(line) <= 75.0: print "light middle"
    elif 75.0 < float(line) <= 81.0: print "middle"
    elif 81.0 < float(line) <= 91.0: print "light heavy"
    else:print "heavy"

Measured memory_bytes: 6376
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);

		long a = scan.nextLong();
		long b = scan.nextLong();
		long x = scan.nextLong();

		System.out.println(f(b,x) - f(a-1,x));
	}
	
	public static long f(long s, long x){
		if(s == -1){
			return 0;
		}
		return s / x + 1;
	}
}


Measured memory_bytes: 23252
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const INF = (1 << 31) - 1

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	A := nextInt()
	fmt.Println(N*N - A)
}

// -------- Library --------
var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	v, _ := strconv.Atoi(next())
	return v
}

func nextIntArray(size int) []int {
	res := make([]int, size)
	for i := 0; i < size; i++ {
		res[i] = nextInt()
	}
	return res
}

func min(a int, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func shift(p int) int {
	return 1 << uint(p)
}


Measured memory_bytes: 640
n = int(input())
b = list(map(int,input().split()))

res = 0
count = 0

for i in range(1,n-2):
  if b[i] >= b[i+1]:
    res += b[i+1]
    count += 1
  else:
    res += b[i]
    count += 1
    
res += b[0]
res += b[n-2]
count += 2

if count == n:
  print(res)
else:
  while count < n:
     if b[0] >= b[1]:
      res += b[1]
      count += 1
     else:
       res += b[0]
       count += 1
  print(res)

Measured memory_bytes: 3064
w,h,n=map(int,input().split())
x1=0
x2=w
y1=0
y2=h
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    x1=max(x1,x)
  if a==2:
    x2=min(x2,x)
  if a==3:
    y1=max(y1,y)
  if a==4:
    y2=min(y2,y)
if x2<x1 or y2<y1:
  print(0)
else:
  print((x2-x1)*(y2-y1))


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

int main(){
  int N;
  cin >> N;
  
  vector<int>a(N);
  for(int i = 0; i < N ; i++){
    cin >> a.at(i);
  }
  int Alice = 0, Bob = 0; 
  
  sort(a.begin(), a.end(), greater<int>());
  
  for(int i = 0; i < N / 2; i++){
    Alice += a.at(i * 2);
    Bob += a.at(i * 2 + 1);
  }
  if(N % 2 == 1)Alice += a.at(N - 1);
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Free = len([a for a in A if a >= 3200])
NotFree = len(set([a // 400 for a in A if a < 3200]))

if NotFree == 0:
    print(1, Free)
else:
    print(NotFree, NotFree + Free)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, M;
    cin >> N >> M;

    if (N % 2 == 0) {
        for (ll i = 1; i <= M; i++) {
            if (i <= N/4) {
                cout << i << " " << N+1-i << "\n";
            } else {
                cout << i << " " << N-i << "\n";
            }
        }
    } else Rep (i, M) {
        cout << i+1 << " " << N-1-i << "\n";
    }
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}
int lcm(int x,int y){
  return x/gcd(x,y)*y;
}
int main(){
  int a;cin >> a;
  cout << lcm(a,360)/a << "\n";
}

Measured memory_bytes: 3616
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int main()
{
	owo
   int n;
   cin>>n;
   vector<vector<bool>>adj(n,vector<bool>(n,0));
   for(int i=0;i<n;i++){
	   for(int j=0;j<n;j++){
	   bool x;
	   cin>>x;
	   adj[i][j] = x;
   }
}
   vector<ll>dp((1<<n)+2);
   dp[0] = 1;
   for(int mask = 0;mask<(1<<n)-1;mask++)
   {
	   for(int b=0;b<n;b++){
		   int a = __builtin_popcount(mask);
		   
		   if(adj[a][b] && !(mask&(1<<b))){
			   int nw_mask = mask^(1<<b);
			   dp[nw_mask]+=dp[mask];
			   dp[nw_mask]%=MOD;
		   }
	   }
   }
   cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 19540
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

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

int main(void) {
    int n;
    bool flag=false;

    cin>>n;

    FOR(i,1,9){
        FOR(k,1,9){
            if(n==i*k){
                flag=true;
            }
        }
    }
    if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl; 
    }
}


Measured memory_bytes: 256