akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;

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

int gcd(vector<int> a) {
  int ans = a[0];
  for (int i = 1; i < a.size(); i++) {
    ans = gcd(ans,a[i]);
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans = gcd(a);
  cout << ans << endl;
}



Measured memory_bytes: 1024
import java.io.*;
class Main
{
    public static void main(String args[]) throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),k=Integer.parseInt(s[2]),a[][]=new int[n][m],i,j,tot=0;
        for(i=0;i<n;i++)
        {
            String st=bu.readLine();
            for(j=0;j<m;j++)
            if(st.charAt(j)=='#') {a[i][j]=1; tot++;}
        }

        int all=(int)Math.pow(2,n+m);
        int ans=0;
        for(i=0;i<all;i++)
        {
            int ar[]=new int[32],p=0,x=i;
            while(x!=0)
            {
                if((x&1)==1) ar[p]++;
                p++;
                x>>=1;
            }
            int l,cn=0; boolean vis[][]=new boolean[n][m];
            for(j=0;j<n;j++)
            if(ar[j]==1)
            {
                for(l=0;l<m;l++)
                if(a[j][l]==1 && !vis[j][l])
                {
                    vis[j][l]=true;
                    cn++;
                }
            }
            for(j=0;j<m;j++)
            if(ar[j+n]==1)
            {
                for(l=0;l<n;l++)
                if(a[l][j]==1 && !vis[l][j])
                {
                    vis[l][j]=true;
                    cn++;
                }
            }
            //System.out.print(i+" "+cn+" ");
            if(tot-cn==k) ans++;
        }
        System.out.print(ans);
    }
}

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


int main() {
    string S; cin >> S;
    int ans = 0;
    queue<char> q;
    q.push(S[0]);
    for (int i = 1; i < S.size(); i++) {
        if (q.empty()) {
            q.push(S[i]);
            continue;
        }
        char prev = q.front();
        q.pop();
        char cur = S[i];
        if (prev != cur) {
            ans += 2;
        } else {
            q.push(prev);
            q.push(cur);
        }
    }

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

Measured memory_bytes: 512
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
typedef pair<int,int>P;
int main(void)
{
	int n,i,h,a,b,sum,cnt,x;
	P pp[200000];
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++)	{
		scanf("%d %d",&a,&b);
		pp[i*2].first=a;
		pp[i*2].second=2;
		pp[i*2+1].first=b;
		pp[i*2+1].second=1;
	}
	sort(pp,pp+n*2,greater<P>() );
	cnt=0;
	for(i=0;i<n*2;i++)	{
		if(pp[i].second==2)	break;
		h=h-pp[i].first;
		cnt++;
		if(h<=0)	break;
	}
	if(h>0)	{
		x=h/pp[i].first;
		if(h%pp[i].first!=0)	x++;
		cnt+=x;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1664
// by gantheory™
#include <bits/stdc++.h>

using namespace std;

const long long N = 1e5 + 10;

long long n, m, ans, col[ N ];
vector< long long > adj[ N ];

bool dfs( long long now, long long parent ) {
  for ( auto child : adj[ now ] )
    if ( child != parent ) {
      if ( col[ child ] != -1 ) {
        if ( col[ child ] == col[ now ] )
          return false;
        continue;
      }
      col[ child ] = col[ now ] ^ 1;
      if ( !dfs( child, now ) )
        return false;
    }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);cin.tie(0);cout.setf(ios::fixed);cout.precision(20);
  cin >> n >> m;
  for ( long long i = 0 ; i < m ; ++i ) {
    long long u, v; cin >> u >> v;
    adj[ u ].push_back( v );
    adj[ v ].push_back( u );
  }

  fill( col + 1, col + 1 + n, -1 );
  col[ 1 ] = 0;
  if ( dfs( 1, 1 ) ) {
    long long num[ 2 ] = { 0, 0 };
    for ( long long i = 1 ; i <= n ; ++i )
      ++num[ col[ i ] ];
    cout << num[ 0 ] * num[ 1 ] - m << '\n';
  }
  else
    cout << n * ( n - 1 ) / 2 - m << '\n';
}


Measured memory_bytes: 7424
#include <stdio.h>

long gcd_euclid(long m, long n) {
	long temp;
	while (n) {
		temp = m % n;
		m = n;
		n = temp;
	}
	return m;
}

int main() {
	long a, b;
	long temp;
	long gcd, lcm;

	while (scanf("%ld %ld", &a, &b) != EOF) {
		gcd = gcd_euclid(a, b);
		temp = a / gcd;
		lcm = temp * b;
		printf("%ld %ld\n", gcd, lcm);
	}

	return 0;
}

Measured memory_bytes: 596
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]

    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    n,m = LI()
    v = []
    for i in range(m):
        a,b,c = LI()
        v.append((c,a,b))
    v.sort()
    par = [i for i in range(n)]
    rank = [0]*n
    ans = 0
    for c,x,y in v:
        if root(x) != root(y):
            ans += c
            unite(x,y)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 23640
process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const A = +lines[0].split(" ")[0];
	const B = +lines[0].split(" ")[1];
	
	if(A>=13){console.log(B)}
	else if(A>=6){console.log(B/2)}
	else{console.log(0)}
});

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll l,r;cin>>l>>r;
  for(i=l;i<=r&&i<=l+2019;i++){
    for(j=i+1;j<=r&&j<=l+2019;j++){
      chmin(res1,(i*j)%2019);
    }
  }
  cout<<res1<<endl;
  return 0;
}

Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar[4] = {{0,1},{0,-1},{1,0},{-1,0}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a == b && b == c){
    cout << "No" << endl;
  }else if(a == b || b == c || c == a){
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from collections import deque

s=deque(input())
q=int(input())

rev=0
for i in range(q):
  l=input().split()
  if len(l)==1:
    rev+=1
  else:
    t,f,c=l[0],l[1],l[2]

    if rev%2==0:
      if f=='1':
        s.appendleft(c)
      else:
        s.append(c)
    else:
      if f=='1':
        s.append(c)
      else:
        s.appendleft(c)

if rev%2==1:
  s.reverse()
print(''.join(s))

Measured memory_bytes: 8436
f = lambda: list(map(int,input().split()))
f_ = lambda: [int(x)-1 for x in input().split()]

n,m = f()
sus = set()
conf = [0]
num = [1 for _ in range(n)]
for _ in range(m):
    x,y = f_()
    num[x] -= 1; num[y] += 1
    if x in conf:
        if num[y] == 1:
            conf = [y]
        else:
            conf = []
            sus.add(y)
    elif y in conf:
        conf = []
        sus.add(y)
    elif x in sus:
        sus.add(y)
        if num[x] == 0:
            sus.remove(x)
print(max(len(sus),1))

Measured memory_bytes: 12840
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn is_larger(a: &str, b: &str) -> bool {
    a.len() > b.len() || (a.len() == b.len() && a > b)
}

fn main() {
    let (n, m) = read_cols!(usize, usize);
    let mut a = read_vec::<i64>();

    assert_eq!(a.len(), m);

    a.sort();

    let mut dp = vec![None; 10001];
    dp[0] = Some(String::new());
    let result = a.iter().fold(dp, |mut dp, &aa| {
        let cost: usize = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6][aa as usize];
        for i in cost..dp.len() {
            let candidate = match dp[i - cost] {
                Some(ref prev) => aa.to_string() + prev,
                None => {
                    continue;
                }
            };
            dp[i] = match dp[i] {
                Some(ref current) if is_larger(&candidate, current) => Some(candidate),
                None => Some(candidate),
                _ => {
                    continue;
                }
            };
        }
        dp
    });
    println!("{}", result[n].as_ref().unwrap_or(&String::from("none")));
    /*
    let ans = result[n].as_ref().unwrap();

    println!("{}", ans);
    */
}


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

using namespace std;

int main()
{
	int n; cin >> n;
	vector<int> c, v;
	for (int i = 0; i < n; i++)
	{
		int num; cin >> num;
		v.push_back(num);
	}

	
	for (int i = 0; i < n; i++)
	{
		int num; cin >> num;
		c.push_back(num);
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (v[i] > c[i])
			ans += (v[i] - c[i]);
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main() {
    int N; string S;
    cin >> N >> S;
    int C = count(S.begin()+1, S.end(), 'E');
    int min_count = C;

    for(int i=1; i<S.size(); i++) {
        if(S[i] == 'E') C--;
        if(S[i-1] == 'W') C++;
        min_count = min(min_count, C);
    }
    cout << min_count << endl;
}

Measured memory_bytes: 3896
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=350;
//↑templete
signed main(){
	int H, W, K;
	cin>>H>>W>>K;
	vector<string> S;
	vint A;
	int fir=-1;
	for(int i=0;i<H;i++){
		string s;
		cin>>s;
		S.pb(s);
		int num=0;
		for(char c:s)
			if(c=='#')
				num++;
		A.pb(num);
		if(fir==-1 && num)
			fir=i;
	}
	int ans[SIZE][SIZE]={};
	int now=1;
	for(int i=fir;i<H;i++){
		if(A[i]==0){
			for(int j=0;j<W;j++)
				ans[i][j]=ans[i-1][j];
			continue;
		}

		for(int j=0;j<W;j++){
			ans[i][j]=now;
			if(S[i][j]=='#'){
				A[i]--;
				if(A[i])
					now++;
			}
		}
		now++;
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout<<(i<fir?ans[fir][j]:ans[i][j])<<" ";
		}
		cout<<endl;
	}

	return 0;
}

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


int main(){
	int n;
	cin>>n;
	
	pair<int, int> g[n];
	
	for (int i=0; i<n; i++){
		int k;
		cin>>k;
		g[i]=make_pair(k,i+1);
		
	}
	
	sort(g,g+n);
	
	for (int i=0; i<n; i++) cout<<g[i].second<<" ";
}


Measured memory_bytes: 1536
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n = int(input())

ans = 0

for i in range(1, n+1):
    if i%3 == 0 or i%5 == 0:
        continue
    ans += i

print(ans)


Measured memory_bytes: 69920
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define pb push_back
#define LIMIT 1000000007 //10^9+7
using ll = long long;
#define debug2(x,y) cout<<"("<<#x<<","<<#y<<") = ("<<(x)<<","<<(y)<<")\n"

namespace /* combination.cpp */{
  namespace /* modinv.cpp */{
    namespace /* extGCD.cpp */{
      long long extGCD(long long a, long long b, long long &x, long long &y) {
          if (b == 0) {
              x = 1;
              y = 0;
              return a;
          }
          long long d = extGCD(b, a%b, y, x);
          y -= a/b * x;
          return d;
      }
    }
    long long modinv(long long a, long long p){
      long long x, y;
      extGCD(a, p, x, y);
      return (x>0? x: x+p);
    }
  }
  long long l_fac(long long n){
    if(n<0) return -1;
    long long ans = 1;
    for(long long i=1; i<=n; i++){
      ans *= i;
      ans %= LIMIT;
    }
    return ans;
  }
  long long l_nPr(long long n, long long r){
    long long ans = 1;
    for(long long i=0; i<r; i++){
      ans *= (n-i);
      ans %= LIMIT;
    }
    return ans;
  }
  long long l_nCr(long long n, long long r){
    if(r > n/2) r = n-r;
    return l_nPr(n, r) * modinv(l_fac(r), LIMIT) % LIMIT;
  }
}

int N,K; //頂点 色
vvi G; //グラフ
vi seen; //訪問済み
ll ans;

void bfs(){
  queue<int> que;
  que.push(0);

  while(!que.empty()){
    int now = que.front();
    que.pop();
    seen[now] = true;
    if(now==0){
      //debug2(now+1, G[now].size());
      ans *= l_nPr(K-1, G[now].size());
      ans %= LIMIT;
    }else{
      //debug2(now+1, G[now].size()-1);
      ans *= l_nPr(K-2, G[now].size()-1);
      ans %= LIMIT;
    }

    for(int x: G[now]){
      if(seen[x])continue;
      que.push(x);
    }
  }
}

int main(){
  cin>>N>>K;
  G.resize(N);
  seen.resize(N, false);
  ans = 1;
  int a,b;
  for(int i=0; i<N-1; i++){
    cin>>a>>b;
    a--;b--;
    G[a].pb(b);
    G[b].pb(a);
  }

  bfs();

  cout<<ans*K%LIMIT<<endl;
}

Measured memory_bytes: 6904
N, Y = gets.split.map(&:to_i)
(N+1).times do |n10|
    r = N - n10
    y = Y - n10 * 10000
    next if y < 0
    (r+1).times do |n5|
        r2 = r - n5
        y2 = y - n5 * 5000
        if r2 * 1000 == y2
            puts [n10, n5, r2].join(' ')
            exit
        end
    end
end

puts '-1 -1 -1'

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

#define FOR(i,a,b) for(ll i=a; i<b; i++)
#define IN(a) cin>>a
#define OUT(a) cout<<a<<endl

template<typename T> void combSort(vector<T>& v){
  size_t h = (v.size()*10)/13;
  bool is_sorted = false;
  while(!is_sorted){
    if(h==1)is_sorted = true;
    for(size_t i=0; i<v.size()-h; ++i){
      if(v[i]>v[i+h]){
        swap(v[i],v[i+h]);
        if(is_sorted)is_sorted = false;
      }
    }
    if(h>1) h = (h*10)/13;
    if(h==0) h = 1;
  }
}


int main(){
  int n, k;
  IN(n); IN(k);
  vector<int> p(n);
  FOR(i,0,n){
    IN(p.at(i));
  }
  combSort(p);
  int ans = 0;
  FOR(i,0,k){
    ans += p.at(i);
  }
  OUT(ans);
    
}

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

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> s(h);
    for(int i=0;i<h;i++) cin>>s[i];

    vector<vector<int>> token(h-1,vector<int>(w-1,0));
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w-1;j++){
            token[i][j]=s[i][j]^s[i][j+1]^s[i+1][j]^s[i+1][j+1];
        }
    }
    vector<vector<int>> height(h,vector<int>(w,0));
    for(int i=0;i<w-1;i++) height[0][i]=1;
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w-1;j++){
            if(token[i][j]) height[i+1][j]=1;
            else height[i+1][j]=height[i][j]+1;
        }
    }
    int res=h;
    for(int i=0;i<h;i++){
        stack<pair<int,int>> st;
        st.push({0,-1});
        for(int j=0;j<w;j++){
            pair<int,int> ret;
            while(ret=st.top(),height[i][j]<ret.first){
                st.pop();
                int lef=st.top().second;
                int size=(j-lef)*ret.first;
                res=max(res,size);
            }
            st.push({height[i][j],j});
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 35712
n=int(input())
p=list(map(int,input().split()))
res=0
for i in range(n-2):
    if p[i]<p[i+1] and p[i+1]<p[i+2]:
        res+=1
    if p[i]>p[i+1] and p[i+1]>p[i+2]:
        res+=1
print(res)

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) {
		cout << c << endl;
	}
	if (b == c) {
		cout << a << endl;
	}
	if (c == a) {
		cout << b << endl;
	}
	return 0;
}

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

A = factorization(N)

if len(A)==0 or N==1:
    print(0)
else:    
    c = 0
    for a in A:
        x = a[1]
        s = 0
        for j in range(1, x+1):
            if s + j <= x:
                c +=1
                s += j
            else:
                break
    print(c)

Measured memory_bytes: 9500
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let H: usize = sc.get();
    let W: usize = sc.get();
    let K: usize = sc.get();
    let c: Vec<Vec<char>> = sc.mat_chars(H);
    let mut ans = 0;
    for bit1 in 0..1<<H {
        for bit2 in 0..1<<W {
            let mut cnt = 0;
            for i in 0..H {
                if (bit1>>i) & 1 != 0 {
                    continue;
                }
                for j in 0..W {
                    if (bit2>>j) & 1 != 0 {
                        continue;
                    }
                    if c[i][j] == '#' {
                        cnt += 1;
                    }
                }
            }
            if cnt == K {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

int main(){
  int A,B;
  cin >> A >> B;
  if ( (A % 2) == 1 && (B % 2) == 1){
    cout << "Odd" << endl;
  }
  else{
    cout << "Even" << endl;
  }
}

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

int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
   
      long long n,i,j,k,sum=0,count=0,ans=0,x=0,y=0,l,r,m;
      cin>>n>>x>>y;
      k=n/x;
      if(n%x==0)
      cout<<k*y;
      else
      {
          k++;
          cout<<k*y;
          }
     

	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>

using namespace std;

long long n,m,x[100001],total,in,nowp,add;

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

	x[0] = 0;
	for(int i =1; i < n; i++){
		cin >> in;
		x[i] = x[i-1] + in;
	}

	nowp = 0;
	for(int i = 0; i < m; i++){
		cin >> in;
		add = x[nowp] - x[nowp+in];
		if(add < 0){
			add *= -1;
		}
		total += add;
		nowp += in;
	}

	total %= 100000;
	cout << total << endl;

	return 0;
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=10000000000;

//main
int main() {
    
    //入力
    long N,K;
    cin>>N>>K;
    vector<long> x(N);
    for(int i=0;i<N;i++){
        cin>>x.at(i);
    }
    
    //計算
    long ans=INF;
    for(int i=0;i<N-K+1;i++){
        ans=min(ans,x.at(i+K-1)-x.at(i)+min(abs(x.at(i)),abs(x.at(i+K-1))));
    }
    
    //出力
    cout<<ans<<endl;
}

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

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

	vector<int> ans( N, -1 );
	int flag = 0;
	for( int i = 0; i < M; i++ ) {
		if( ans[ s[i] ] >= 0 && ans[ s[i] ] != c[i] ) {
			cout << -1 << endl;
			return 0;
		}
		ans[ s[i] ] = c[i];
		if( s[i] == 0 && c[i] == 0 ) flag = 1;
	}
	for( int i = 0; i < N; i++ ) {
		if( ans[i] < 0 ) ans[i] = 0;
	}
	if( N > 1 && ans[0] == 0 ) {
		if( flag ) {
			cout << -1 << endl;
			return 0;
		}
		else ans[0] = 1;
	}

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


Measured memory_bytes: 3592
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 1000000007
#define mxval 1e9 + 7
#define grt [](auto x,auto y){return x>y;}
#define pii pair<int,int>
/*********VARIABLE****************/
using namespace std;
int i,j,n,m,k,l,q,t,a,b,sum[3],tot[3],cnt[3];
/*********FUNCTIONS**************/
int powom(int a,int b) {
    int result = 1;
    while (b > 0) {
        if (b & 1)
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
/***********MAIN**************/
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    cout<<(n*n*n);
    return 0;
}
//.........

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

// clang-format off
#define forn(i, x, y) for(int i = x; i < y; i++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
// clang-format on

const long long MOD = 1000000007;

using LL = long long;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVLL = vector<VLL>;
using VVVLL = vector<VVLL>;

void add(LL &a, LL b)
{
  a += b;
  if (a >= MOD)
    a -= MOD;
}

int main()
{
  IOS;

  string K;
  cin >> K;
  int D;
  cin >> D;

  int n = K.size();
  VVVLL dp(10001, VVLL(2, VLL(100)));
  dp[0][0][0] = 1;

  forn(i, 0, n) forn(s, 0, 2) forn(d, 0, D)
  {
    for (int x = 0; x <= (s ? 9 : K[i] - '0'); x++)
      add(dp[i + 1][s || x < K[i] - '0'][(d + x) % D], dp[i][s][d]);
  }
  LL res = dp[n][0][0] + dp[n][1][0] - 1;
  if (res < 0)
    res += MOD;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 20252
a,b,m=map(int,input().split())
alis=list(map(int,input().split()))
blis=list(map(int,input().split()))
ans=10**18
d=dict()
for i in range(m):
  x,y,c=map(int,input().split())
  x-=1
  y-=1
  d[(x,y)]=c
  ans=min(ans,alis[x]+blis[y]-c)
alis1=[]
blis1=[]
for i in range(a):
  alis1.append((alis[i],i))
for i in range(b):
  blis1.append((blis[i],i))
alis1.sort()
blis1.sort()
if (alis1[0][1],blis1[0][1]) not in d:
  ans=min(ans,alis1[0][0]+blis1[0][0])
print(ans)

Measured memory_bytes: 93420
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;
int main()
{
	int n, l;
	cin >> n >> l;
	vector<int> a(n);
	deque<pair<int, int>> ic, ic2;
	ll sum = 0;
	rep(i, n)
	{
		cin >> a[i];
		ic.push_back(make_pair(i, a[i]));
		sum += a[i];
	}
	bool ok=false;
	int ite=0;
	rep(i,n-1){
		if(a[i]+a[i+1]>=l){
			ok=true;
			ite=i;
		}
	}
	if (ok)
	{
		cout << "Possible" << endl;
		rep(i,ite){
			cout<<i+1<<endl;
		}
		rep(i,n-ite-1){
			cout<<n-1-i<<endl;
		}
	}
	else
	{
		cout << "Impossible" << endl;
	}
}


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

int main()
{
	int p1x = 0, p1y = 0, p2x = 0, p2y = 0, q = 0, px = 0, py = 0;
	int a = 0, b = 0;
	long c = 0, s = 0;
	double x = 0, y = 0;

	cin >> p1x >> p1y >> p2x >> p2y;
	cin >> q;

	a = p2y - p1y;
	b = p1x - p2x;
	c = - p1x * p2y + p1y * p2x;

	for (int i = 0; i < q; i++) {
		cin >> px >> py;

		s = a * px + b * py + c;
		x = px - 2 * (double)(s * a) / (double)(a * a + b * b);
		y = py - 2 * (double)(s * b) / (double)(a * a + b * b);

		cout << setprecision(10) << setiosflags(ios::fixed | ios::showpoint) 
			 << x << " " << y << endl;
	}
		
	return 0;
}

Measured memory_bytes: 3284
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        direct = A[i][j]
        for k in range(N):
            if k == i or k == j:
                continue
            ind = A[i][k] + A[k][j]
            if direct > ind:
                print(-1)
                exit()
            elif direct == ind:
                break
        else:
            ans += direct
print(ans)


Measured memory_bytes: 45276
#if 1

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;


template<typename T, typename U>
void fill_all_impl(T& arr, const U& v, ...) {
	arr = v;
}
template<typename ARR, typename U>
auto fill_all_impl(ARR& arr, const U& v, std::nullptr_t = nullptr)->decltype(std::begin(arr), void()) {
	for (auto& i : arr) {
		fill_all_impl(i, v);
	}
}
template<typename T, typename U>
void fill_all(T& arr, const U& v) { fill_all_impl(arr, v, nullptr); }




// 最大公約数（Greatest Common Divisor）
uint64_t gcd(uint64_t m, uint64_t n)
{
	// ユークリッドの互除法
	for (;;)
	{
		if (0 == m) { return n; }
		n %= m;
		if (0 == n) { return m; }
		m %= n;
	}
}
// 最小公倍数（Least Common Multiple）を返す。
uint64_t lcm(uint64_t m, uint64_t n)
{
	if (0 == m) { return n; }
	if (0 == n) { return m; }
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int32_t N;
int64_t A[1000000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	for (int32_t i = 0; i < N; ++i)
	{
		in >> A[i];
	}

	for (int32_t i = 1; i < N; ++i)
	{
		A[i] = lcm(A[i - 1], A[i]);
	}
	out << A[N - 1] << endl;

	return 0;
}
#endif



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

int main()
{
	int N;
	cin >> N;
	string S;
	cin >> S;
	vector<int> sum(N + 1);
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + (S[i] == 'W');
	}
	int res = N;
	for (int i = 0; i < N; i++) {
		res = min(res, sum[i] + (N - 1 - i) - (sum[N] - sum[i + 1]));
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1796
#include <bits/stdc++.h>
#define lli long long int
#define MAX(A,B) ((A)>(B)?(A):(B))
#define MIN(A,B) ((A)<(B)?(A):(B))
#define gcd(A,B) __gcd(A,B)
#define lcm(A,B) A/(__gcd(A,B))*B
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define ld long double
#define modulo 998244353
#define usecppio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<int,double> pid;

int food[50];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i = 0; i<n; i++)
    {
        int k;
        scanf("%d",&k);
        for (int j = 0; j<k; j++)
        {
            int x;
            scanf("%d",&x);
            food[x]++;
        }
    }
    int ans = 0;
    for (int i = 1; i<=m; i++)
    {
        if(food[i]==n)
            ans++;
    }
    printf("%d",ans);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	char input[3][15];
  	char ans[5];
	for (int i = 0; i < 3; i++){
      scanf(" %s", &input[i]);
    }
  	ans[0] = input[0][0]-0x20;
  	ans[1] = input[1][0]-0x20;
  	ans[2] = input[2][0]-0x20;
  	ans[3] = '\0';
  
  	printf("%s\n", ans);
  	return 0;
}

Measured memory_bytes: 128
n = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(1, max(H) + 1):
    Hi = [j for j, h in enumerate(H) if h >= i]
    count = 0
    for j in range(len(Hi) - 1):
        if Hi[j + 1] - Hi[j] > 1:
              count += 1
    count += 1
    ans += count
print(ans)


Measured memory_bytes: 3060
import sys
from collections import deque

H, W = map(int, input().split())
s_y, s_x = (0, 0)
g_y, g_x = (H-1, W-1)

c = [input() for a in range(H)]

d = [[ sys.maxsize for b in range(W)] for a in range(H)]

blackcount = 0
for y in range(H):
  blackcount += c[y].count('#')

dy = [1, 0, -1, 0]
dx = [0, 1, 0, -1]

q = deque([[s_y, s_x]])

d[s_y][s_x] = 0

while len(q) > 0:
  y, x = q.popleft()
  if y==g_y and x==g_x:
    print(H * W - blackcount - 1 - d[y][x])
    exit()
  for i in range(4):
    ny = y + dy[i]
    nx = x + dx[i]
    if 0 <= nx and nx <= W-1 and 0 <= ny and ny <= H-1 and c[ny][nx] == '.' and d[ny][nx] == sys.maxsize:
      q.append([ny, nx])
      d[ny][nx] = d[y][x]+1
      
print(-1)
      

Measured memory_bytes: 3316
//
// Created by Tzyark on 2018/9/19.
//
#include <iostream>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int ans = k;
    for (int i = 1; i < n; i++) {
        ans *= (k-1);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int main(){
	int n;
	while(cin>>n){
		bool flg = false;
		rep(i,20){
			if((n&(1<<i))>0){
				if(flg)printf(" ");
				printf("%d",(1<<i));
				flg=true;
			}
		}puts("");
	}
	
	
}

Measured memory_bytes: 1144
from bisect import bisect_left, bisect_right
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    for j in range(i+1, N):
        a = L[i]
        b = L[j]
        r = bisect_right(L, a+b-1) - 1
        ans += r - j
print(ans)

Measured memory_bytes: 44160
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    map<int, int> as;
    rep(i, n) {
        int x;
        cin >> x;
        as[x]++;
    }
    int res = 0;
    for (auto [k, v] : as) {
        if (v % 2) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 8148
import java.io.*;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");
		
		while (scan.hasNext()) {
			int d = scan.nextInt();
			
			int area=0;
			for(int i=0;i<600/d;i++){
				area += (i*d)*(i*d);
			}
			System.out.println(area*d);
		}
		scan.close();
	}
}

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


int main() {
	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int i=0;i<n;i++){
	   cin>>arr[i];
	}
	int dp[k+1] = {};
	for(int stones = 0; stones <= k; stones++){
	    for(int wt : arr){
	        if(stones >= wt and !dp[stones-wt] ){
	            dp[stones] = 1;
	        }
	    }
	}
	
    cout<<(dp[k]?"First":"Second")<<endl;
	return 0;
}

Measured memory_bytes: 4000
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b % a == 0) {
            System.out.println(a + b);
        } else {
            System.out.println(b - a);
        }
    }
}


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

int main() {
  int n;
  double t,a;
  cin >>n>>t>>a;
  vector<double>x(n);
  for(int i=0;i<n;i++)cin>>x[i];
  double sa=1e18;
  int bango=0;
  for(int i=0;i<n;i++){
    double kion=a-(t-0.006*x[i]);
    if (kion<0)kion*=-1;
    //cout<<kion<<endl;
    if(sa>kion){
      sa=kion;
      bango=i+1;
    }
  }
  cout<<bango<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
N = int(input())
num_edges = N-1
edges = [list(map(int, input().split())) for i in range(num_edges)]

adj = [[] for i in range(N+1)]
for ed in edges:
    adj[ed[0]] += [[ed[1]] ]
    adj[ed[1]] += [[ed[0]] ]
c_list = list(map(int, input().split()))
c_list = sorted(c_list)
d_list = [-1 for i in range(N+1)]

def recfun(vi, ind, M):
    d_list[vi] = 0 #数を更新
    for ed in adj[vi]: #隣接する頂点をみる
        if d_list[ed[0]] == -1: #更新していない場合
            ind, M = recfun(ed[0], ind, M) #その先をみる
    d_list[vi] = c_list[ind] #数を更新
    M += c_list[ind]
    ind += 1
    return  ind, M
        
_, M  = recfun(1, 0, 0)
print(M-c_list[-1])
print(" ".join(map(str, d_list[1:])))

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll LL_INF = LLONG_MAX;
const long double PI = (acos(-1));
const ull MOD = 1000000007;


struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main(){
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <stdio.h>
#include <cmath>
#include <string.h>
#include <vector>

#define ll long long
using namespace std;

int main()
{
    //freopen("C:\\Users\\23733\\Desktop\\in.txt","r",stdin);
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
count = 0
for i in range(2 ** n):
    check = True
    bin_str = format(i, 'b').rjust(n + 1, "0")
    for j in range(m):
        light = 0
        for k in range(1, len(l[j])):
            if bin_str[l[j][k]] == "1":
                light += 1
        if not (light % 2 == p[j]):
            check = False
    if check:
        count += 1
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

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

	if (n < 10) {
		cout << r + 100*(10-n) << endl;
	} else {
		cout << r << endl;
	}
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <functional>
#include <ostream>
#include <queue>
#include <random>
#include <string>
#include <map>
#include <vector>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using ll = long long;

// #define DEBUG

inline void init() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
}

template <typename T>
std::ostream& operator << (std::ostream& os, std::vector<T>& v) {
  os << "[";
  for (int i = 0; i < int(v.size()); ++i) {
    os << v[i] << (i == int(v.size()) - 1 ? "" : ", ");
  }
  os << "]";

  return os;
}

template <typename T, typename U>
std::ostream& operator << (std::ostream& os, std::pair<T, U>& p) {
  os << "(" << p.first << ", " << p.second << ")";

  return os;
}

int main() {
  init();

  int N;
  std::vector<int> x;

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

  auto v = x;

  std::sort(v.begin(), v.end());

  for (int i = 0; i < N; ++i) {
    if (x[i] < v[N / 2]) {
      cout << v[N / 2] << endl;
    }
    else {
      cout << v[N / 2 - 1] << endl;
    }
  }

  return 0;
}

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

int n;
const ll MOD = 1e9 + 7;
ll a, sol = 0;
ll arr[200005];
ll suf[200005];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (int i = n-1; i >= 0; i--) {
        suf[i] = (suf[i + 1] + arr[i]) % MOD;
    }

    for (int i = 0; i < n; i++) {
        sol += arr[i] * suf[i + 1];
        sol %= MOD;
    }

    cout << sol << endl;
}


Measured memory_bytes: 6736
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define N 200001

int parent(int i){
return i / 2;
}
int left(int i){
return i * 2;
}
int right(int i){
return i  *2 + 1;
}

int main(){

    int i, j, z[255];
    scanf("%d", &j);
    for(i = 1; i <= j; i++){
    	scanf("%d", &z[i]);
	}

    for(i = 1 ; i <= j ; i++) {
        printf("node %d: key = %d, ", i, z[i]);
        if(parent(i) >= 1) printf("parent key = %d, ", z[i / 2]);
        if(left(i) <= j) printf("left key = %d, ", z[i * 2]);
        if(right(i) <= j) printf("right key = %d, ", z[i * 2 + 1]);
        printf("\n");
    }

    return 0;
}



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

int w,h;
int maps[50][50];

void dfs(int y, int x)
{
  int dx[]={1,-1,0,0};
  int dy[]={0,0,1,-1};

  maps[y][x]=0;

  for(int i=0;i < 4;i++){
    for(int j=0;j < 4;j++){
      int xx = x + dx[j];
      int yy = y + dy[i];
      if(maps[yy][xx] == 1 && xx >= 0 && xx < w && yy >= 0 && yy < h) dfs(yy,xx);
    }
  }
}

int main(){
  while(cin >> w >> h && w)
    {
      for(int i=0;i < h;i++){
	for(int j=0;j < w;j++){
	  cin >> maps[i][j];
	}
      }
      int island=0;

      for(int i=0;i < h;i++){
	for(int j=0;j < w;j++){
	  if(maps[i][j] == 1){
	    island++;
	    dfs(i,j);
	  }
	}
      }
      cout << island << endl;
    }
  return 0;
}



Measured memory_bytes: 3304
#include<bits/stdc++.h> 
  
using namespace std; 
#define mod 1000000007 

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int n,m,k;
    cin>>n>>k;
    m=k;
    int a[n],i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int mx[n],j;
    mx[0]=0;
    if(k>n)
    {
        k=n;
        
    }
    for(i=1;i<n;i++)
    {
     mx[i]=INT_MAX;
     k=m;
     for(j=i-1;j>=0&&k>0;j--)
     {
         mx[i]=min(mx[i],mx[j]+abs(a[i]-a[j]));
         k--;
     }
    
    }
    cout<<mx[n-1];
    
}

Measured memory_bytes: 4360
if __name__ == "__main__":
    NK = input().rstrip().split(' ')
    N = int(NK[0])
    K = int(NK[1])
    line = input().rstrip().split(' ')
    A = list(map(lambda x: int(x), line))
    
    # 1 の位置から左右の端までK個づづ変更すればよい
    # one = A.index(1)
    if N == K:
        print("1")
        exit()
    right = 0
    left = N -1
    count = 0
    while True:
        right += (K-1)
        count += 1
        if right >= left:
            print(count)
            break
        left -= (K-1)
        count += 1
        if right >= left:
            print(count)
            break

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

int main(){
  char a,b;
  cin >> a >> b;
  bool A=false;
  if(a==b){
    A=true;
  }
  if(A){
    cout << "H" << endl;
  }
  else{
    cout << "D" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<int>> grid_a(h, vector<int>(w)), grid_b(h, vector<int>(w));
    rep(y, h) rep(x, w) cin >> grid_a[y][x];
    rep(y, h) rep(x, w) cin >> grid_b[y][x];

    const int MAX = (80 + 80) * 80;

    vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(MAX, false)));

    auto get_sub = [&](int y, int x) {
        return abs(grid_a[y][x] - grid_b[y][x]);
    };

    dp[0][0][get_sub(0, 0)] = true;

    rep(y, h) rep(x, w) {
            if (y == 0 && x == 0) continue;

            int sub = get_sub(y, x);

            if (y > 0) {
                rep(i, MAX) {
                    if (dp[y - 1][x][i]) {
                        dp[y][x][i + sub] = true;
                        dp[y][x][abs(i - sub)] = true;
                    }
                }
            }

            if (x > 0) {
                rep(i, MAX) {
                    if (dp[y][x - 1][i]) {
                        dp[y][x][i + sub] = true;
                        dp[y][x][abs(i - sub)] = true;
                    }
                }
            }

        }


    rep(i, MAX) {
        if (dp.back().back()[i]) {
            cout << i << endl;
            ret();
        }
    }

}

Measured memory_bytes: 10752