akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <map>


using namespace std;
typedef long long ll;

//?????????????

int main(){

    string S, T;
    cin >> S >> T;
    map<char, vector<char > > s;
    map<char, vector<char > > t;

    //sort(S.begin(), S.end());
    //sort(T.begin(), T.end());
    //cout << S << endl;
    //cout << T << endl;

    for(ll i = 0; i < S.length(); i++){
        //S????????
        /* 
        if(S[i] == T[i]){
            continue;
        }
        */

        if(s[S[i]].size() == 0){
            s[S[i]].push_back(T[i]);
        }else{
            bool f = 0;
            for(ll j = 0; j < s[S[i]].size(); j++){
                if(s[S[i]][j] == T[i]){
                    f = 1;
                    break;
                }
            }
            if(f == 0){
                s[S[i]].push_back(T[i]);
            }
        }
        //T????????
        if(t[T[i]].size() == 0){
            t[T[i]].push_back(S[i]);
        }else{
            bool f = 0;
            for(ll j = 0; j < t[T[i]].size(); j++){
                if(t[T[i]][j] == S[i]){
                    f = 1;
                    break;
                }
            }
            if(f == 0){
                t[T[i]].push_back(S[i]);
            }
        }
    }

    //1?1??????????????????
    //???????????
    for( auto i = s.begin(); i != s.end() ; ++i ) {
        if(s[i->first].size() > 1){
            cout << "No" << endl;
            return 0;
        }else{
            if(i->first != t[s[i->first][0]][0]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    for( auto i = t.begin(); i != t.end() ; ++i ) {
        if(t[i->first].size() > 1){
            cout << "No" << endl;
            return 0;
        }else{
            if(i->first != s[t[i->first][0]][0]){
                cout << "No" << endl;
                return 0;
            }           
        }
    }

    cout << "Yes" << endl;
    
}

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

using namespace std;

#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 998244353;
const int INF = 1000000007;
const int MAXN = (int)3000+1;

void setIO(string name)
{
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll arr[MAXN], dp[MAXN][MAXN], n, s, ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //setIO("");
    cin >> n >> s;
    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
        for(int j=0; j<=s; j++)
            dp[i+1][j] = dp[i][j];

        dp[i+1][arr[i]] = add(dp[i+1][arr[i]], i+1);
        for(int j=0; j+arr[i] <= s; j++)
        {
            dp[i+1][j+arr[i]] = add(dp[i+1][j+arr[i]], dp[i][j]);
        }
        ans = add(dp[i+1][s], ans);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 70656
import java.util.*;

public class Main{
  public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      
      if(a-b>c){
          System.out.println(0);
      }else{
          System.out.println(c - (a-b));
      }
      
      sc.close();
    }
}

Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from itertools import product

def main():
    N, M = LI()
    kss = []
    for _ in range(M):
        kss.append(LI_()[1:])
    pp = LI()
    ans = 0
    for sw in product(range(2), repeat=N):
        ok = True
        for ks, p in zip(kss, pp):
            check = 0
            for k in ks:
                if sw[k]:
                    check += 1
            if check % 2 != p:
                ok = False
                break
        if ok:
            ans += 1
    return ans

print(main())

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin >> N;
  set<long long> F;
  for (long long i = N - 1; i <= N; i++){
    for (long long j = 1; j * j <= i; j++){
      if (i % j == 0){
        F.insert(j);
        F.insert(i / j);
      }
    }
  }
  int count = 0;
  for (auto K : F){
    if (K == 1) continue;
    long long N2 = N;
    while (N2 % K == 0) N2 /= K;
    if (N2 % K == 1) count++;
  }
  cout << count;
}

Measured memory_bytes: 512
#include<cstdio>

const long A = 1e9 + 7;
long n;
int dp[2][3];

int main() {
    scanf("%ld", &n);
    dp[0][0] = 1;
    for (int i = 59; i >= 0; i--) {
        if ((n >> i) & 1) {
            dp[i & 1][2] = (static_cast<long>(dp[(i + 1) & 1][2]) * 3 + dp[(i + 1) & 1][1] * 2) % A;
            dp[i & 1][1] = (dp[(i + 1) & 1][1] + dp[(i + 1) & 1][0]) % A;
            dp[i & 1][0] = dp[(i + 1) & 1][0];
        }
        else {
            dp[i & 1][2] = (static_cast<long>(dp[(i + 1) & 1][2]) * 3 + dp[(i + 1) & 1][1]) % A;
            dp[i & 1][1] = dp[(i + 1) & 1][1];
            dp[i & 1][0] = (dp[(i + 1) & 1][1] + dp[(i + 1) & 1][0]) % A;
        }
    }
    
    int ans = 0;
    for (int i = 0; i <= 2; i++) ans = (ans + dp[0][i]) % A;
    printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int i,n,x;
     
    scanf("%d",&n);
     
    for(i=1;i<=n;i++){
        x=i;
        if(x%3==0){
            printf(" %d",i);
        }else if(x%10==3){
            printf(" %d",i);
        }else{
            while(1){
                x/=10;
                if(x==0) break;
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }
            }
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2104
N, K = map(int, input().split())
A = list(map(int, input().split()))
bits = [0]*41
for i in range(N):
    for j in range(41):
        if A[i] & (1 << j):
            bits[40-j] += 1


bin_K = '0' * (43 - len(bin(K))) + bin(K)[2:]
x = 0
flag = 0  # 0ならX > Kが保証されていない、1なら保証されている
threshold = N // 2 + 1
for i in range(41):
    if flag == 1:
        if bits[i] < threshold:
            x += 1 << (40-i)
    elif flag == 0:
        if bits[i] < threshold and bin_K[i] == '1':
            x += 1 << (40-i)
        elif bits[i] >= threshold and bin_K[i] == '1':
            flag = 1


ans = 0
for i in range(N):
    ans += x ^ A[i]

print(ans)


Measured memory_bytes: 15144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=~(1<<31),MAXN=1e6+10;
const int MOD=1e9+7;

int a[MAXN],n;
int num[MAXN];

ll ksm(ll x,ll v)
{
    ll ans=1;
    while(v)
    {
        if(v&1)(ans*=x)%=MOD;
        (x*=x)%=MOD;
        v>>=1;
    }
    return ans;
}

int main()
{
    ll n;
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%2==n%2)return puts("0"),0;
        num[a[i]]++;
    }
    if(n&1)
        if(num[0]!=1)return puts("0"),0;
    for(int i=(n+1)%2;i<=n;i+=2)
        if(num[i]!=2&&i!=0)
            return puts("0"),0;
    printf("%lld",ksm(2ll,n/2));
	return 0;
}


Measured memory_bytes: 4736
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
        sc.Scan()
        i, e := strconv.Atoi(sc.Text())
        if e != nil {
                panic(e)
        }
        return i
}

func firstLine(i int) bool {
        return i == 1
}

func lastLine(i int, h int) bool {
        return i == h
}

func main() {
        sc.Split(bufio.ScanWords)

        for {
                h := nextInt()
                w := nextInt()

                if h == 0 && w == 0 {
                        break
                }

                for i := 1; i <= h; i++ {
                        if firstLine(i) || lastLine(i, h) {
                                fmt.Printf(strings.Repeat("#", w))
                        } else {
                                fmt.Print("#")
                                if w > 1 {
                                        fmt.Print(strings.Repeat(".", w-2))
                                        fmt.Print("#")
                                }
                        }
                        fmt.Println()
                }
                fmt.Println()
        }
}


Measured memory_bytes: 1168
#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if (a==0)
		cout<<1;
	else if (b==0)
		cout<<2;
	else if (c==0)
		cout<<3;
	else if (d==0)
		cout<<4;
	else
		cout<<5;
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int a[1005],n,k,i,ans;

int main(){
	cin>>n>>k;
	
	for(i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+n+1);
	
	for(i=1;i<=k;i++)
	ans+=a[i];
	 
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////	
	string a,b;
	cin >> a >> b;
	vector<char> v;
	REP(i,a.size()+b.size()){
		if(i%2==0){
			v.push_back(a[i/2]);
		}else{
			v.push_back(b[i/2]);
		}
	}
	SREP(i,v){
		cout << v[i];
	}
	cout << endl;
//////////////////////////////////////////////
}


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

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

int main(){
  long N, X;
  cin >> N >> X;
  if(N==1){
    long x; cin >> x;
    cout << abs(X-x) << endl;
    return 0;
  }
  vector<long> x;
  for(int i=0; i<N; i++){
    long a; cin >> a;
    x.push_back(a);
  }
  long d= abs(X-x[0]);
  for(int i=1; i<N; i++){
    d = gcd(d, abs(x[i]-x[i-1]));
  }
  cout << d << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	double a,b;cin>>a>>b;
	double c=a*b/(a+b);
	cout<<fixed<<setprecision(10)<<c<<"\n";
}

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

a_dic = {}
for i in range(n):
    if a[i] in a_dic.keys():
        a_dic[a[i]] += 1
    else:
        a_dic[a[i]] = 1

lis = sorted(list(a_dic.values()))
res = 0
if k >= len(lis):
    print(res)
else:
    for i in range(len(lis)-k):
        res += lis[i]
    print(res)

Measured memory_bytes: 32184
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
char a;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> a;
  if(a - 'A' >= 32) cout << 'a' << endl;
  else cout << 'A' << endl;
}


Measured memory_bytes: 3612
#include <iostream>

int main() {
  std::string str;
  std::cin >> str;

  int a, b;
  for (int i = 0; i < str.size(); ++i) {
    if (str.at(i) == 'A') {
      a = i;
      break;
    }
  }
  std::reverse(str.begin(), str.end());
  for (int i = 0; i < str.size(); ++i) {
    if (str.at(i) == 'Z') {
      b = i;
      break;
    }
  }
  std::cout << str.size() - a - b << std::endl;
}


Measured memory_bytes: 832
use std::collections::BinaryHeap;
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (n, m) = get!(usize, usize);
    let mut v = Vec::new();
    for _ in 0..n {
        let tmp = get!(usize, usize);
        v.push(tmp);
    }
    v.sort_by(|x, y| x.0.cmp(&y.0));
    //eprintln!("{:?}", v);
    let mut pq = BinaryHeap::new();
    let mut j = 0;
    let mut ans = 0;
    for i in (0..m).rev() {
        //eprintln!("m-i: {}", m - i);
        while j < n && v[j].0 <= m - i {
            pq.push(v[j].1);
            j += 1;
            //eprintln!("j: {}", j);
        }
        match pq.pop() {
            Some(n) => {
                ans += n;
            }
            None => {}
        }
    }
    //eprintln!("pq: {:?}", pq);
    println!("{}", ans);
}


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

int main() {
    int h,w;
    cin >> h >> w;
    char s[h][w];
    for(int i = 0; i < h; i++){
        string s_in;
        cin >> s_in;
        for(int j = 0; j < w; j++){
            s[i][j] = s_in.at(j);
        }
    }

    for(int i = 0; i < h ; i++){
        for(int j = 0; j < w; j++){
            int sum = 0;
            if(s[i][j] == '.'){
                if(i != 0){
                    if(s[i-1][j] == '#')sum++;
                }
                if(j != 0){
                    if(s[i][j-1] == '#')sum++;
                }
                if(i != h-1){
                    if(s[i+1][j] == '#')sum++;
                }
                if(j != w-1){
                    if(s[i][j+1] == '#')sum++;
                }
                if(i != 0 && j != 0){
                    if(s[i-1][j-1] == '#')sum++;
                }
                if(i != h-1 && j != 0){
                    if(s[i+1][j-1] == '#')sum++;
                }
                if(i != 0 && j != w-1){
                    if(s[i-1][j+1] == '#')sum++;
                }
                if(i != h-1 && j != w-1){
                    if(s[i+1][j+1] == '#')sum++;
                }
                if(sum == 0){
                    s[i][j] = '0';
                }
                if(sum == 1){
                    s[i][j] = '1';
                }
                if(sum == 2){
                    s[i][j] = '2';
                }
                if(sum == 3){
                    s[i][j] = '3';
                }
                if(sum == 4){
                    s[i][j] = '4';
                }
                if(sum == 5){
                    s[i][j] = '5';
                }
                if(sum == 6){
                    s[i][j] = '6';
                }
                if(sum == 7){
                    s[i][j] = '7';
                }
                if(sum == 8){
                    s[i][j] = '8';
                }
            }
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << s[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
X, Y = map(int, input().split())

n = 10 ** 18
A = [1]
i = 0
while A[i] < n:
    A.append(A[i] * 2)
    i += 1

Y //= X
X = 1

ans = 0
for a in A:
    if X <= a <= Y:
        ans += 1
print(ans)


Measured memory_bytes: 3060
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
A = []
B = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

ahi = [True] * N
for i, a in enumerate(A):
    b = B[i]
    a -= 1
    b -= 1
    if H[a] < H[b]:
        ahi[a] = False
    elif H[a] == H[b]:
        ahi[a] = False
        ahi[b] = False
    else:
        ahi[b] = False
#  for i, h in enumerate(H):
    #  ahi[]
    #  ok = True
    #  for a_i in [i for i, a in enumerate(A) if a == h]:
        #  a = A[a_i]
        #  b = B[a_i]
        #  if h <= H[b]:
            #  ok = False
            #  break
    #  ahi[i] = ok

print(len(list(filter(lambda x: x, ahi))))


Measured memory_bytes: 92616
// https://atcoder.jp/contests/abc140/tasks/abc140_d
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize, k: usize,
        s: chars
    };

    let mut score = 0;
    for i in 0..n {
        if i+1 < n && s[i] == 'R' && s[i+1] == 'R' {
            score += 1;
        } else if i >= 1 && s[i] == 'L' && s[i-1] == 'L' {
            score += 1;
        }
    }
    let score = min(n-1, score + k * 2);
    println!("{}", score);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int n,m,t[1000],d[1000],p[1000],z[1000];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>t[i];
  }
  cin>>m;
  for(int i=1;i<=m;i++){
    cin>>d[i]>>p[i];
  }
  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      z[i]+=t[j];
    }
  }
  for(int i=1;i<=m;i++){
    cout<<z[i]-t[d[i]]+p[i]<<"\n";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <random>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}

int main(){
    ll h,w;
    cin>>h>>w;
    vector<string> s(h);
    ll mat[h][w];
    rep(i, h)rep(j, w) mat[i][j]=-1;
    mat[0][0]=0;
    rep(i, h) cin>>s[i];
    ll mini=-1;
    ll argx=0,argy=0;
    queue<pair<int, int>> v;
    v.push(make_pair(0, 0));
    int z1[4]={0,1,0,-1};
    int z2[4]={1,0,-1,0};
    bool flag=false;
    while (v.size()!=0) {
        if(mat[h-1][w-1]!=-1) {flag=true;break;}
        auto a=v.front();
        v.pop();
        rep(j, 4){
            if(a.first+z1[j]>=0 &&
               a.first+z1[j] <h &&
               a.second+z2[j]>=0 &&
               a.second+z2[j] <w &&
               mat[a.first+z1[j]][a.second+z2[j]]==-1 &&
               s[a.first+z1[j]][a.second+z2[j]]=='.'
               ){
                mat[a.first+z1[j]][a.second+z2[j]]=mat[a.first][a.second]+1;
                v.push(make_pair(a.first+z1[j], a.second+z2[j]));
            }
            
        }
    }
    if(flag){
        ll summ=0;
        rep(i, h)rep(j, w) if(s[i][j]=='.')summ++;
        pr(summ - mat[h-1][w-1]-1);}
    else{
        pr("-1");
        
    }
    return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
C = [list(input()) for i in range(h)]

queue = []
visited = [] 
visited = [[0 for i in range(w)] for i in range(h)]
ans = 0

for i in range(h):
    for j in range(w):
        if C[i][j] == '.':
            queue.append([i,j])
            visited[i][j] = 1

            dy_dx = [[1,0],[0,1],[-1,0],[0,-1]]

            while len(queue) > 0:
                now = queue.pop(0)
                for k in range(4):
                    y = now[0]+dy_dx[k][0]
                    x = now[1]+dy_dx[k][1]
                    if 0 <= y < h and 0 <= x < w:
                        if C[y][x] != '#' and visited[y][x] == 0:
                            visited[y][x] = visited[now[0]][now[1]]+1 #移動回数のカウント
                            queue.append([y,x])
                    
        for l in range(h):
            for m in range(w):
                ans = max(ans,visited[l][m])
            
        queue = []
        visited = [[0 for i in range(w)] for i in range(h)]              
        
print(ans-1)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
using namespace std;

typedef long long int ll;
const ll MAX = 3e5 + 10;
ll a[MAX]; ll b[MAX]={0};

int main()
{
	int n; cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];

	for(int i=n;i>0;i--){
		int c = 0;
		int j = 2*i;
		while(j <= n){
			if(b[j]) c++;
			j += i;
		}
		if(a[i]==0){
			if(c%2){
				b[i]=1;
			}
		}
		else{
			if(c%2==0){
				b[i]=1;
			}
		}
	}
	vector<int> v;
	for(int i=1;i<=n;i++) if(b[i]) v.push_back(i);
	cout<<v.size()<<endl;
	for(int x : v) cout<<x<<" ";	
}

Measured memory_bytes: 4984
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int l[2000];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &l[i]);
    }

    sort(l, l+n);
    int count = 0;
    for(int a=0; a<n-2; a++){
        for(int b=a+1; b<n-1; b++){
            for(int c=b+1; c<n; c++){
                if(l[a]+l[b]<=l[c]){
                   break;
                }
                if(l[a]>=l[b]+l[c]){
                    continue;
                }
                if(l[b]<l[c]+l[a]){
                    count++;
                }
            }   
        }
    }
    printf("%d", count);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
 
const double EPS = 1e-9;
const double PI = 6.0 * asin(0.5);
 
namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}
 
double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
 
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
 
bool isIntersect(L s1, L s2){
  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}
 
vector<P> convex_hull(vector<P> v){
  vector<P> c; 
  sort(v.begin(),v.end());
  c.assign(v.begin(),v.begin()+2);
     
  for(int i=2;i<v.size();i++){
    P a = c[c.size()-1] - c[c.size()-2];
    P b = v[i] - c[c.size()-2];
         
    while(cross(a,b) > EPS){
      c.pop_back();
      if(c.size() < 2) break;
      a = c[c.size()-1] - c[c.size()-2];
      b = v[i] - c[c.size()-2];
    }
    c.push_back(v[i]);
  }
     
  int n = c.size();
  c.push_back(v[v.size()-2]);
     
  for(int i=v.size()-3;i>=0;i--){
    P a = c[c.size()-1] - c[c.size()-2];
    P b = v[i] - c[c.size()-2];
         
    while(cross(a,b) > EPS){
      c.pop_back();
      if(c.size() < n + 1) break;
      a = c[c.size()-1] - c[c.size()-2];
      b = v[i] - c[c.size()-2];
    }
    c.push_back(v[i]);
  }
  c.pop_back();
  return c;
}
 
 
vector<P> p1,p2;
int n,m;
int solve(){
  if(n+m<3) return 1;
  if(m==1&&n==2) return ccw(p1[0],p1[1],p2[0])!=0;
  if(n==2&&m==2) return !isIntersect(L(p1[0],p1[2]),L(p2[0],p2[1]));
 
  if(n<3) return 0;
  vector<P> t=convex_hull(p1);
  for(int i=0;i<=(int)t.size();i++){
    int flg=1;
    for(int j=0;j<m&&flg;j++)
      if(ccw(t[i],t[(i+1)%t.size()],p2[j])!=1)flg=0;
    if(flg) return 1;
     
  }
  return 0;  
}
 
 
int main(){
  while(1){
    cin>>n>>m;
    if(!n&&!m)return 0;
    p1.resize(n),p2.resize(m);
    for(int i=0,a,b;i<n;i++)cin>>a>>b,p1[i]=P(a,b);
    for(int i=0,a,b;i<m;i++)cin>>a>>b,p2[i]=P(a,b);
    int ans=solve();
    swap(p1,p2);
    swap(n,m);
    ans|=solve();
    cout<<(ans?"YES":"NO")<<endl;
  }
  return 0;
}

Measured memory_bytes: 3052
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N;
	cin >> N;
 
	// 解法
	ll ans = 0;
	REP(i, N+1){
		if (pow(i,2)<=N) ans = pow(i,2);
		else break;
	}
	
	//出力
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int p;
        double[] B = new double[N];
        double[] S = new double[N];
        for(int i=0;i<N;i++){
            p = sc.nextInt();
            B[i] = (double)(1+p)/(double)2;
            if(i == 0){
                S[i] = B[i];
            }else {
                S[i] = S[i - 1] + B[i];
            }
        }
        double res;
        double maxRet = 0;
        for(int i=K-1; i<N;i++){
            if(i == K-1){
                res = S[i];
            }else{
                res = S[i] - S[i-K];
            }
            maxRet = Math.max(res, maxRet);
        }
        System.out.println(maxRet);

    }
}

Measured memory_bytes: 76992
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  string str;

  cin>>str;

  string temp="CF";

  int j=0;
  
  for(int i=0;i<str.length();i++){
    if(str[i]==temp[j]){
      j++;
    }

    if(j==2){
      cout<<"Yes"<<endl;
      return 0;
    }
  }

  cout<<"No"<<endl;
  
  return 0;
  
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string n;int x = 0,y = 0;set<char> s;
	cin>>n;
	for(int i =0 ; i < n.size(); i ++)
	{
		s.insert(n[i]);
		if(n[i] == 'S')
		{
			if(y > 0 && n[i + 1] != 'S')
			{
				y =0 ; 
			}
			else
			y--;
		}else if(n[i] == 'N')
		{
			if(y < 0 && n[i + 1] != 'N')
			{
				y = 0;
			}
			else
			y++;
		}else if(n[i] == 'W')
		{
		    if(x > 0 && n[i + 1] != 'W')
		    {
		    	x = 0;
			}else{
				x--;
			}
		}
		else
		{
		   	if(x < 0 &&n[i + 1] == 'E')
		   	{
		   		x =  0;
			   }else
			   {
			   	x++;
			   }
		}
	}
	bool c = false;char a ,b;set <char>::iterator it;
	if(s.size() == 2)
	{
		for(it = s.begin(); it != s.end(); ++it)
		{
			if(!c)
			{
				a = *it;
				c = true;
			}else
			{
				b = *it;
			}
		}
	}
	if((a == 'N' && b == 'S') || (a == 'S' && b =='N') || (a == 'W' && b == 'E') || (a =='E' && b == 'W'))
	{
		cout<<"Yes";
		return 0;
	}
	if(x == 0 && y == 0 )
	{
		cout<<"Yes";
	}else
	{
		cout<<"No";
	}
}

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



int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);

if(a<b&&b<c){printf("Yes\n");}
else{printf("No\n");}

return 0;
}



Measured memory_bytes: 2060
import java.math.BigInteger;
        import java.util.Scanner;





public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        BigInteger x = cin.nextBigInteger();
        for(int i = -200;i <= 200;i++){
            for(int j = -200;j <= 200;j++){
                BigInteger a = BigInteger.valueOf(i);
                BigInteger b = BigInteger.valueOf(j);
                BigInteger cur = a.pow(5);
                BigInteger cnt = b.pow(5);
                BigInteger ans = cur.subtract(cnt);
                if(ans.equals(x)){
                    System.out.println(i + " " + j);return ;
                }
            }
        }
    }
}


Measured memory_bytes: 45704
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100005;
int N;
vector<int> G[maxn];
void Add(int u, int v) {
	G[u].push_back(v);
}
int dis[maxn], size[maxn], vis[maxn];
void dfs(int x, int y) {
	if(x == N) vis[x] = 1;
	size[x] = 1;
	for(int i = 0; i < (int)G[x].size(); ++i) {
		int to = G[x][i];
		if(to == y) continue;
		dis[to] = dis[x] + 1;
		dfs(to, x);
		size[x] += size[to];
		if(vis[to]) vis[x] = 1;
	}
}
int main() {
	scanf("%d", &N);
	for(int i = 1, u, v; i < N; ++i) {
		scanf("%d%d", &u, &v);
		Add(u, v); Add(v, u);
	}
	dfs(1, -1);
	if(dis[N] & 1) {
		for(int i = 1; i <= N; ++i) 
			if(vis[i] && dis[i] * 2 == dis[N] + 1) {
				if(size[i] * 2 >= N) {
					puts("Snuke");
				} else {
					puts("Fennec");
				}
			}
	} else {
		for(int i = 1; i <= N; ++i)
			if(vis[i] && dis[i] * 2 == dis[N] + 2) {
				if(size[i] * 2 + 1 > N) {
					puts("Snuke");
				} else {
					puts("Fennec");
				}
			}
	}
}


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

using namespace std;

int main()
{
  /*  int i;
    scanf("%d",&i);
    printf("%d",i*i);*/
  /*  int a[7];
    for(int i=0;i<6;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<6;i++){
        for(int z=0;z<6;z++){
            if(a[i]-a[z]>=a[5]){
                printf(":(");
                return 0;
            }
        }
    }

    printf("Yay!");
*/
char s[10009] ;
scanf("%s",s);
int l = strlen(s);
int  w=l/2,c=0;
for(int i=0 ; i<w; i++)
{
    if(s[i] != s[l-i-1]) c++;
}
printf("%d",c);



    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int a; /* 高橋君のモンスターの体力 */
	int b; /* 高橋君のモンスターの攻撃力 */
	int c; /* 青木君のモンスターの体力 */
	int d; /* 青木君のモンスターの攻撃力 */
	
	scanf("%d%d%d%d", &a, &b, &c, &d);
	
	while ((a >= 0) || (c >= 0)) {
		c -= b;
		a -= d;
		if (c <= 0) {
			printf("Yes");
			break;
		}
		else if (a <= 0) {
			printf("No");
			break;
		}
	}
	return EXIT_SUCCESS;
}


Measured memory_bytes: 1696
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int ans = 0;
    for(int i = 0; i < 1000000; i++){
        if (i * i > n) break;
        else ans = i; 
    }
    printf("%d\n", ans * ans);
}

Measured memory_bytes: 760
A,B = (int(x) for x in input().split())
if A == B:
  print ('Draw')
elif A > B:
  if A == 13 and B == 1:
    print ('Bob')
  else:
    print ('Alice')
else:
  if A == 1 and B == 13:
    print ('Alice')
  else:
    print ('Bob')

Measured memory_bytes: 9124
import java.util.Scanner;

class Main {
	public static void main(String[] $){
		Scanner sc =new Scanner(System.in);
		int n = sc.nextInt();

		int sum = 0;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				for (int k = 1; k <= n; k++) {
					int tmp = gcd(j, k);
					sum += gcd(i, tmp);
				}
			}
		}

		System.out.println(sum);

		sc.close();
	}

    public static int gcd(int m, int n) {
        int r;
        while (n > 0) {
            r = m % n;
            m = n;
            n = r;
        }
        return m;
    }
}

Measured memory_bytes: 27240
/*
 *  Created on: 22-December-2019
 *      Author: ankur314
 */
#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define db double
#define ldb long double
#define vr vector
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007
#define INF 1000000005
 
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
 
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n; cin>>n;
    int a[n];
    fi(i,0,n) cin>>a[i];
    int idx = 1;
    int cnt = 0;
    fi(i,0,n)
    {
    	if(a[i] != idx)
    	{
    		cnt++;
    	}
    	else
    	{
    		idx++;
    	}
    }
    if(cnt == n) cnt = -1;
    cout<<cnt;
    return 0;
}   

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long INF = 9000000007;
int main() {
	long long N; cin >> N;
	vector<long long>A;
	A.push_back(INF);
	for (long long i = 1; i <= N; i++) {
		long long B; cin >> B;
		if (B != A.back()) A.push_back(B);
	}
	A.push_back(A.back());
	vector<long long>C;
	long long money = 1000;
	for (long long i = 1; i < A.size() - 1; i++) {
		if (A.at(i - 1) > A.at(i)) {
			if (A.at(i) <= A.at(i + 1)) {
				C.push_back(A.at(i));
			}
		}
		else if (A.at(i - 1) < A.at(i)) {
			if (A.at(i) >= A.at(i + 1)) {
				C.push_back(A.at(i));
			}
		}
	}
	if (C.empty()) {
		cout << 1000 << endl;
	}
	else {
		for (long long i = 1; i < C.size(); i += 2) {
			long long num = (money / C.at(i - 1)) * (C.at(i) - C.at(i - 1));
			if (money + num >= money) money += num;
		}
		cout << money << endl;
	}
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	string S;
	cin >> S;

	string r = S;
	reverse(r.begin(), r.end());

	int n = S.size();
	if(r==S && r.substr(0, (n-1)/2) == S.substr((n+1)/2, (n-1)/2) && r.substr((n+1)/2, (n-1)/2) == S.substr(0, (n-1)/2)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


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

constexpr int64_t INF = 1'010'000'000'000'000'017LL;
constexpr int64_t MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(int64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

// 最小公倍数lcm=m*n/gcd
uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// nCm
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

signed main() {
  uint64_t n, a;
  string inStr;
  cin >> inStr;
  
  if(inStr[1] == 'B') {
    inStr[1] = 'R';
  }
  else{
    inStr[1] = 'B';
  }
  
  cout << inStr;
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <utility>
using namespace std;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N;cin>>N;
    vector<pair<int,int> > A;
    map<pair<int,int>, int> M;
    for(int i=0;i<N;++i){
        int x,y;cin>>x>>y;
        A.emplace_back(x,y);
    }

    int ans = 0;
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            if(i==j) continue;
            int p = A[j].first - A[i].first;
            int q = A[j].second - A[i].second;
            ++M[make_pair(p,q)];
        }
    }
    for(auto itr=M.begin();itr!=M.end();++itr) ans = max(ans,itr->second);
    cout << N - ans << '\n';
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

int main()
{
    int a, b; cin >> a >> b;
    cout << (a+b) % 24 << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main (int argc, char const *argv[])
{
    int64_t A, B, C;
    int64_t max, ans = 0;

    scanf("%"PRId64"%"PRId64"%"PRId64, &A, &B, &C);

    max = A > B ? A : B;
    max = max > C ? max : C;

    ans = A + B + C + max * 10 - max;

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


Measured memory_bytes: 128
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	u := nextInt()
	v := nextInt()

	g := make([][]int, n+1)
	for i := 0; i < n-1; i++ {
		a := nextInt()
		b := nextInt()
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}

	vs := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		vs[i] = -1
	}

	vs[v] = 0
	q := make([]int, 0)
	q = append(q, v)
	for len(q) > 0 {
		cv := q[0]
		q = q[1:]
		for _, nv := range g[cv] {
			if vs[nv] > -1 {
				continue
			}
			q = append(q, nv)
			vs[nv] = vs[cv] + 1
		}
	}

	us := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		us[i] = -1
	}
	us[u] = 0

	q = make([]int, 0)
	q = append(q, u)
	for len(q) > 0 {
		cu := q[0]
		q = q[1:]
		for _, nu := range g[cu] {
			if us[nu] > -1 {
				continue
			}
			us[nu] = us[cu] + 1
			if us[nu] < vs[nu] {
				q = append(q, nu)
			}
		}
	}

	ans := 0
	for i := 0; i < n+1; i++ {
		if us[i] == -1 || vs[i] < us[i] {
			continue
		}
		ans = max(ans, vs[i]-1)
	}

	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 15600
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto dp = new long[](N + 2);
    dp[] = long.max;
    dp[0] = 0;
    foreach (i; 0 .. N)
    {
        dp[i + 1] = dp[i + 1].min(dp[i] + 1);
        {
            long tmp = 6;
            while (i + tmp <= N)
                dp[i + tmp] = dp[i + tmp].min(dp[i] + 1), tmp *= 6;
        }
        {
            long tmp = 9;
            while (i + tmp <= N)
                dp[i + tmp] = dp[i + tmp].min(dp[i] + 1), tmp *= 9;
        }
    }
    writeln(dp[N]);
}


Measured memory_bytes: 2684
H, W, M = map(int, input().split())
X = [0 for i in range(H)]
Y = [0 for j in range(W)]
s = set([])
for i in range(M):
  h, w = map(int, input().split())
  X[h-1] += 1
  Y[w-1] += 1
  s.add((h-1, w-1)) #タプルを使う
mX = max(X)
mY = max(Y)
I = [i for i in range(H) if X[i] == mX]
J = [j for j in range(W) if Y[j] == mY]
flag = 0
for i in I:
  for j in J:
    if {(i, j)} <= s:
      continue
    flag = 1
    print(mX+mY)
    break
  if flag == 1:
    break
if flag == 0:
  print(mX+mY-1)

Measured memory_bytes: 157112
#include <iostream>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define F first
#define S second
#define ll long long
const int MOD = 1e9 + 7;
const float epsilon = 0.0005f;
const float PI = 3.1415926535897932384626433f;
 
vector<pair<int,int>> dire{{0,1},{0,-1},{1,0},{-1,0}};
 
// std::cout << std::fixed;
// std::cout << std::setprecision(9);

void solve(){
    int n;
    cin >> n;
    vector<ll> a(n, 0);
    ll sum = 0;
    for (int i = 0; i < n;i++){
        cin >> a[i];
        sum += a[i];
        sum = sum % MOD;
    }
    ll ans = 0;
    for (int i = 0; i < n ;i++){
        sum -= a[i];
        if(sum <0){
            sum = sum + MOD;
        }
        ans += a[i] * sum;
        ans = ans%MOD;
    }
    cout << ans << "\n";
}
    
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    // int t;cin>>t;
    // for(int i = 0;i<t;++i){
    //     solve();
    // }
    solve();
    return(0);
}

Measured memory_bytes: 4772
# N = gets.to_i
S = gets.chomp
# a = gets.split.map(&:to_i)

s = S.gsub(?A, ?0).gsub(?T, ?0).gsub(?G, ?0).gsub(?C, ?0)
# p s
n = s.size

ans = k = 0

s.chars do |c|
  
  if c == ?0
    k += 1
  else
    ans = k if ans < k
    k = 0
  end
end

ans = k if ans < k

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    int a, p;cin>>a>>p;
    
    cout << (a*3+p)/2 << endl;
}

Measured memory_bytes: 256
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

from collections import deque
from bisect import bisect_right
S = deque(list(str(input())))
Q = I()

one = []
isone = []
F = [0]*Q
C = [0]*Q
for i in range(Q):
    q = input().split()
    if q[0]=='1':
        one.append(i)
        isone.append(True)
    else:
        F[i] = (int(q[1]))
        C[i] = q[2]
        isone.append(False)


num = sum(isone)
if num%2==1:
    S = deque(list(reversed(S)))

bef = deque([])
aft = deque([])
for i,now in enumerate(isone):
    if now==1:
        if num%2==1:
            for b in reversed(bef):
                S.append(b)
            for a in aft:
                S.appendleft(a)
        else:
            for b in reversed(bef):
                S.appendleft(b)
            for a in aft:
                S.append(a)
        bef = deque([])
        aft = deque([])
        num -= 1
    else:
        if F[i]==1:
            bef.appendleft(C[i])
        else:
            aft.append(C[i])
for b in reversed(bef):
    S.appendleft(b)
for a in aft:
    S.append(a)
print(*S,sep='')

Measured memory_bytes: 102492
def change_base(n, base):
    q = n // base
    r = n % base
    if q == 0:
        return str(r)
    return change_base(q, base) + str(r)


N, A, B, C = map(int, input().split())
target = [A, B, C]
l = [int(input()) for _ in range(N)]
ans = float('inf')
for n in range(4**N):
    bit = change_base(n, 4)
    bit = '0'*(N-len(bit)) + bit
    start = [0] * 3
    mp = 0
    for i in range(N):
        for j in range(3):
            if bit[i] == str(j):
                if start[j] > 0:
                    mp += 10
                start[j] += l[i]
    if any(s == 0 for s in start):
        continue
    for j in range(3):
        mp += abs(target[j]-start[j])
    ans = min(ans, mp)
print(ans)


Measured memory_bytes: 3064