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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;



//DONT WASTE YOUR TIME......i said don't waste -_- 
//prove yourself remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

// fortunately or unfortunately tu sabse badaah chodu h ....ek number ka chutiyaa -_-

const ll N= 1e6+55,mod = 1e9+7;

int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
 	//cout<<"snuke\n";
 	ll i,j,k,a,b,c;
 	sc(a);sc(b);sc(c);
 	i=a+b;
 	if(i>=c)printf("Yes\n");
 	else printf("No\n");
}

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

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

const ll MOD = 1e9+7;

// Combinationの使い方
// vector<vector<ll>> v(N+1, vector<ll>(N+1, 0));
// comb(v);
void comb(vector<vector<ll>> &v){
    for(int i = 0; i < v.size(); i++){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(int k = 1; k < v.size(); k++){
        for(int j = 1; j < k; j++){
            v[k][j] = (v[k-1][j-1] + v[k-1][j]);
            //余りを求める問題は毎回計算ごとにやる
            // v[k][j] = (v[k-1][j-1] + v[k-1][j]) % MOD;
        }
    }
}

// Union Find
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v = get<0>(item);
// long w = get<1>(item);
// long v, w;
//   for( int i = 0; i < N; i++ ){
//     cin >> v >> w;
//     items.push_back( make_tuple(v, w) ); // item : (value, weight)
//   }

// 1 << 3 : int "3" change to bit "100"
// rep(pattern, 1 << N) if (pattern & (1 << x)) cnt++

vector<int> D(10+1, -1);

int check(int N){
    while(N!=0){
        rep(i,D.size()){
            if(D[i] == N % 10) return 1;
        }
        N /= 10;
    }
    return 0;
}

int main(){
    int N,K;
    cin >> N >> K;
    rep(i,K) cin >> D[i];

    while(check(N)) N++;
    cout << N << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] $$) throws Exception {
		Scanner $ = new Scanner(System.in);
		String S = $.next();
		int Flag = 0;
		for (int i = 0; i < S.length() - 1; i++){
			if (S.substring(i, i + 1).equals(S.substring(i + 1, i + 2))){
				Flag += 1;
				break;
			}
		}
		if (Flag == 0) System.out.println("Good");
		else System.out.println("Bad");
		/*
		3776 -> Bad
		8080 -> Good
		1333 -> Bad
		0024 -> Bad
		*/
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#include<cstdlib>
#define INF 1001001001001001001
#define MAX 2001001

#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

vector<int>ch[300001];
int main() {
	int h, w, m;
	cin >> h >> w >> m;
	vector<pair<int, int>>b(m);
	vector<pair<int, int>>cw(w + 1, { 0,0 });
	rep(i, 0, w + 1)cw[i].second = i;
	rep(i, 0, m) {
		cin >> b[i].first >> b[i].second;
		ch[b[i].first].push_back(b[i].second);
		cw[b[i].second].first++;
	}
	size_t mhsize = 0;
	vector<int>a;
	rep(i, 0, h + 1) {
		if (ch[i].size() > mhsize) {
			mhsize = ch[i].size();
			a.clear();
			a.push_back(i);
		}
		if (ch[i].size() == mhsize) {
			a.push_back(i);
		}
	}
	for(auto n:a)sort(ch[n].begin(), ch[n].end());
	sort(cw.rbegin(), cw.rend());
	int mw = cw[0].first;
	int ans = 0;
	int z = mhsize;
	for (auto n : a) {
		rep(i, 0, w + 1) {
			int flag = 0;
			if (mw != cw[i].first)break;
			if (binary_search(ch[n].begin(), ch[n].end(), cw[i].second))flag++;
			ans = max(ans, z + mw - flag);
			if (ans == z + mw)break;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

#define ll long long

ll count(ll n)
{
	if (n == 1) {
		return 1;
	}
	return count(floor(n / 2)) * 2 + 1;
}

int main()
{
	ll N;
	cin >> N;
	cout << count(N) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long sq(long long a)
{
    return a * a * a * a * a;
}

int main(int argc, char const *argv[])
{
    long long X;
    cin >> X;
    long long sum;
    for (long long i = -118; i <= 119; i++)
    {
        int d = 0;
        sum = 0;
        while (sum < X)
        {
            d++;
            sum = sq(i) - sq(i - d);
            if (sum == X)
            {
                cout << i << ' ' << i - d << endl;
                return 0;
            }

        }
           
    }

    cout << "ないで" << endl;
    
    return 0;
}

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

/*int main(){
    int a,i,ans=0;
    
    cin >> a;
    
    while(a){
        i = a % 10;
        ans += i;
        a /= 10;
    }

    cout << ans << endl;

}*/

int main()
{
    int s, ans;
    cin >> s;

    while (s)
    {
        ans += s % 10;
        s /= 10;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  
  int sum = 0;
  int cut = inf;
  for (int i = 0; i < N; i++)
  {
    int s;
    cin >> s;
    sum += s;
    if (s % 10 != 0) chmin(cut, s);
  }
  
  int ans;
  if (sum % 10 != 0) ans = sum;
  else if (cut < inf) ans = sum - cut;
  else ans = 0;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
s=input().split()
n=int(s[0])
c=int(s[1])
d=[[0 for i in range(c+1)] for j in range(c+1)]
for i in range(c):
	s=input().split()
	for j in range(c):
		d[i+1][j+1]=int(s[j])
cnt=[[0 for i in range(c+1)],[0 for i in range(c+1)],[0 for i in range(c+1)]]
for i in range(n):
	s=input().split()
	for j in range(n):
		cnt[(i+j)%3][int(s[j])]+=1
		cnt[(i+j)%3][0]+=1
iwa=[[0 for i in range(c+1)],[0 for i in range(c+1)],[0 for i in range(c+1)]]
for i in range(1,c+1):
    for j in range(1,c+1):
        for k in range(3):
            iwa[k][i]+=d[j][i]*cnt[k][j]
m=10**9
for i in range(1,1+c):
    for j in range(1,1+c):
        for k in range(1,1+c):
            if i==j or j==k or k==i:
                continue
            m=min(m,iwa[0][i]+iwa[1][j]+iwa[2][k])
print(m)

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

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 2e5+5;

int n,a[N],m;

int getp(int x){
	int l=0,r=n,w=-1;
	for(;l<=r;){
		int mid=(l+r)/2;
		bool yes=1;
		fo(i,1,mid)yes&=(a[i]+a[mid*2-i+1]<=x);
		if (yes)w=mid,l=mid+1;
		else r=mid-1;
	}
	return w*2;
}

int getql(){
	int l=0,r=n,w=n+1;
	for(;l<=r;){
		int mid=(l+r)/2;
		bool yes=1;
		fo(i,1,n*2-mid*2)yes&=(a[mid*2+i]+a[n*2-i+1]>=m);
		if (yes)w=mid,r=mid-1;
		else l=mid+1;
	}
	return w*2;
}

int getqr(int x){
	int l=0,r=n,w=-1;
	for(;l<=r;){
		int mid=(l+r)/2;
		bool yes=1;
		fo(i,1,n*2-mid*2)yes&=(a[mid*2+i]+a[n*2-i+1]<=m+x);
		if (yes)w=mid,l=mid+1;
		else r=mid-1;
	}
	return w*2;
}

bool check(int r){
	int p=getp(r);
	int ql=getql(),qr=getqr(r);
	return ql<=qr&&ql<=p;
}

int main(){
	n=get();m=get();
	fo(i,1,n*2)a[i]=get();
	sort(a+1,a+1+n*2);
	int l=0,r=m,ans;
	for(;l<=r;){
		int mid=(l+r)/2;
		if (check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
package main

// Solution for https://atcoder.jp/contests/abc174/tasks/abc174_f

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

type query struct{ l, r, i int }

func update(i int, v int, bit []int) {
	for i < len(bit) {
		bit[i] += v
		i += i & -i
	}
}

func ask(i int, bit []int) int {
	s := 0
	for i > 0 {
		s += bit[i]
		i -= i & -i
	}
	return s
}

func (con *contest) main() error {
	var n, m int
	con.Scan(&n, &m)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		con.Scan(&c[i])
		c[i]--
	}
	q := make([]query, m)
	for i := 0; i < m; i++ {
		con.Scan(&q[i].l, &q[i].r)
		q[i].l--
		q[i].r--
		q[i].i = i
	}
	sort.Slice(q, func(i, j int) bool { return q[i].r < q[j].r })
	bit := make([]int, n+1)
	last := make([]int, n+1)
	for i := 0; i <= n; i++ {
		last[i] = -1
	}
	ans := make([]int, m)
	j := 0
	for i := 0; i < n; i++ {
		if last[c[i]] != -1 {
			update(last[c[i]]+1, -1, bit)
		}
		last[c[i]] = i
		update(i+1, 1, bit)
		for j < m && q[j].r == i {
			ans[q[j].i] = ask(q[j].r+1, bit) - ask(q[j].l, bit)
			j++
		}
	}
	for i := 0; i < m; i++ {
		con.Println(ans[i])
	}
	return nil
}


Measured memory_bytes: 41028
let S = readLine()!
let i = S.index(S.startIndex, offsetBy: 3)
print(S[..<i])





func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

extension Collection {
    func mapToTuple() -> (Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!, i.next()!)
    }

    subscript(gen: Index) -> Element {
        _modify { yield &self[index(gen, offsetBy: -1)] }
        _read   { yield self[index(gen, offsetBy: -1)] }
    }
}


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

int n, k, x;
long long cnt, dnt;

int main(){
    cin >> n >> k;
    if(k == 1){
        cout << 1LL*n*n*n << '\n';
        return 0;
    }
    for(int i = 1; i * k - k / 2 <= n; i++){
        x = i * k - k / 2;
        if(2 * x % k == 0) ++cnt;
        if(i * k <= n) ++dnt;
    }
    cout << cnt*cnt*cnt + dnt*dnt*dnt << '\n';
}


Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    # 終了
    if n == 0 and x == 0:
        break
    
    count = 0
    for i in range(1, n+1):
        tmp1 = x
        tmp1 -= i
        if tmp1 <= i:
            break
        for j in range(i + 1, n+1):
            tmp2 = tmp1
            tmp2 -= j
            if tmp2 <= j:
                break
            elif tmp2 <= n:
                count += 1
    print(count)


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

template <typename T> int sgn(T val) {
  return (T(0) < val) - (val < T(0));
}

void solve() {
  long long t[2], a[2], b[2];
  scanf("%lld%lld%lld%lld%lld%lld", t, t+1, a, a+1, b, b+1);
  long long p[6][2], d[6];
  for (int i = 0; i < 6; ++i) {
    p[i][0] = t[i%2]*a[i%2];
    p[i][1] = t[i%2]*b[i%2];
    if (!i) continue;
    p[i][0] += p[i-1][0];
    p[i][1] += p[i-1][1];
  }
  for (int i = 0; i < 6; ++i) {
    d[i] = p[i][0]-p[i][1];
  }
  if (d[1] == 0 || d[1] == d[3]) {
    puts("infinity");
    return;
  }
  if (sgn(d[0]) == sgn(d[1])) {
    puts("0");
    return;
  }
  if (d[0]%d[1]==0) {
    printf("%lld", abs(d[0]/d[1]*2));
  } else {
    printf("%lld", abs(d[0]/d[1]*2)+1);
  }
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3816
N = int(input())
H = list(map(int, input().split()))

for i in range(N - 1, 0, -1) :
    if H[i - 1] - H[i] >= 1 :
        H[i - 1] -= 1

for i in range(N - 1) :
    if H[i] - H[i + 1] > 0 :
        print('No')
        break
else :
    print('Yes')

Measured memory_bytes: 15020
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int res = (int)gcd(a,b);
        System.out.println(res);

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



Measured memory_bytes: 26184
#include<bits/stdc++.h>
                #include <set>
                #include<ext/pb_ds/assoc_container.hpp>
				#include<ext/pb_ds/tree_policy.hpp>
				using namespace __gnu_pbds;
				#define ordered_set  tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
                using namespace std;
                #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
                #define pb push_back
                #define ff first
                #define ss second
                #define sz size()
                #define mp make_pair
                #define p(x) cout<< x << " ";
                #define pe(x) cout<< x << endl ;
                #define int long long
                #define double long double
                #define bp __builtin_popcountll
                #define FOR(i,a,b) for(int i=a;i<b;i++)
                #define ROR(i,a,b) for(int i=a;i>=b;i--)
                const int M=998244353;
                const int N=1e6+1;
                
                int32_t main()
                {
                    FAST
                    string s,t;
                    cin>>s>>t;
                    int n1=s.size();
                    int n2=t.size();
                    vector<vector<int> > v(26);
                    for(int i=0;i<n1;i++)
                    {
                    	int x=s[i]-'a';
                    	v[x].pb(i+1);
                    }
                    int last=0,ans=0;
                    for(int i=0;i<n2;i++)
                    {
                    	if(v[(t[i]-'a')].size()==0)
                    	{
                    		return cout<<-1,0;
                    	}
                    	auto it=upper_bound(v[t[i]-'a'].begin(),v[t[i]-'a'].end(),last);
                    	if(it==v[t[i]-'a'].end())
                    	{
                			i--;
                			ans+=n1-last;
                			last=0;
                    	}
                    	else
                    	{
                    		ans+=((*it)-last);
                    		last=*it;
                    	}
                    }
                    cout<<ans;
                    
                }	

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main(void){
    std::vector<vector<int>> vec(3,vector<int>(3));
    int a,n,b;
    for (int i=0;i<3;i++) {
        for (int j=0;j<3;j++) {
            cin>>a;
            vec.at(i).at(j)=a;
        }
    }
    cin>>n;
    for (int hh=0;hh<n;hh++) {
        cin>>b;
        for (int k=0;k<3;k++) {
            for (int l=0;l<3;l++) {
                if (b==vec.at(k).at(l)) {
                    vec.at(k).at(l)=0;
                }
            }
        }
    }
    /*
    for (int hoge=0;hoge<3;hoge++) {
        for (int piyo=0;piyo<3;piyo++) {
            cout<<vec.at(hoge).at(piyo);
        }
        cout<<endl;
    }*/
    if (vec.at(0).at(0)==vec.at(0).at(1)&&vec.at(0).at(1)==vec.at(0).at(2)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(1).at(0)==vec.at(1).at(1)&&vec.at(1).at(1)==vec.at(1).at(2)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(2).at(0)==vec.at(2).at(1)&&vec.at(2).at(1)==vec.at(2).at(2)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(0).at(0)==vec.at(1).at(0)&&vec.at(1).at(0)==vec.at(2).at(0)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(0).at(1)==vec.at(1).at(1)&&vec.at(1).at(1)==vec.at(2).at(1)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(0).at(2)==vec.at(1).at(2)&&vec.at(1).at(2)==vec.at(2).at(2)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(0).at(0)==vec.at(1).at(1)&&vec.at(1).at(1)==vec.at(2).at(2)) {
        cout<<"Yes"<<endl;
    } else if (vec.at(0).at(2)==vec.at(1).at(1)&&vec.at(1).at(1)==vec.at(2).at(0)) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

    int n;
    cin >> n;

    int tenSum = 0;
    int nonTenSum = 0;
    vector<int> nums;

    for (int i = 0; i < n; i++){
        int t;
        cin >> t;

        if (t % 10 == 0){
            tenSum += t;
        } else {
            nonTenSum += t;
            nums.push_back(t);
        }
    }

    if ((tenSum + nonTenSum) % 10 == 0){

        sort(nums.begin(), nums.end());

        while (!nums.empty()){
            int tmp = nums[0];
            nums.erase(nums.begin());
            nonTenSum -= tmp;

            if ((tenSum + nonTenSum) % 10 != 0){
                cout << tenSum + nonTenSum << endl;
                return 0;
                
            }
        }

        cout << 0 << endl;

    } else {
        cout << tenSum + nonTenSum << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n = int(input())
p = list(map(int, input().split()))

d = 0
for i in range(n):
    if p[i] != i + 1:
        d += 1

if d <= 2:
    print('YES')
else:
    print('NO')


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1000006;

int n, a[N];

int main() {

	FAST;

	cin >> n;
	intt sum = 0;
	for (int i = 1; i <= n; i ++) {
		if (i % 3 && i % 5) {
			sum += i;
		}
	}		
	cout << sum << '\n';
	return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
int main(){
  int a,b,c,d;
  int kai=1;
  
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  while(a>0&&c>0){
    if(kai%2==0){
      a=a-d;
    }
    else
      c=c-b;
    
    kai++;
  }
  if(a<=0)
    printf("No");
  else
    printf("Yes");
  
  return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
int dp[3005][3005];
int main()
{
  int sl,tl,i,j;
  string s,t;

  stack<char> st;

  cin>>s>>t;

  sl=s.size();
  tl=t.size();

  for(int i=1; i<=sl; i++){
    for(int j=1; j<=tl; j++){
      if(s[i-1]==t[j-1]){
	dp[i][j]=dp[i-1][j-1]+1;
      }else{
	dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
      }
    }
  }

  i=sl;
  j=tl;
  while(dp[i][j]!=0){
    if(s[i-1]==t[j-1]){
      st.push(s[i-1]);
      i--;
      j--;
    }else if(dp[i-1][j]>dp[i][j-1]){
      i--;
    }else{
      j--;
    }
  }
  while(!st.empty()){
    cout<<st.top();
    st.pop();
  }
  cout<<'\n';
  return 0;
}


Measured memory_bytes: 35456
x1, y1, x2, y2 = map(int, input().split())
a = x2 - x1
b = y2 - y1
x3 = x2 - b
y3 = y2 + a
x4 = x1 - b
y4 = y1 + a
print(x3, y3, x4, y4)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
    
typedef long long ll;
typedef unsigned long long ull;
    
#define MOD 1000000007
#define mi 18446744073709551615


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T=1;
    //cin>>T;
    while(T--)
    {
        int n;
        cin>>n;
        int a[n],c[n];
        for(int i=0;i<n;i++)
            cin>>a[i];
        c[0]=0;c[1]=abs(a[1]-a[0]);
        for(int i=2;i<n;i++)
        {
            c[i]=min(c[i-1]+abs(a[i]-a[i-1]),c[i-2]+abs(a[i]-a[i-2]));
        }
        cout<<c[n-1];
    }    
    return 0;
}

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

int main(){
    string s,in,t;
    cin >> in >> t;
    for(int i=in.size()-1; i>=t.size()-1; i--){
        bool check = true;
        s = in;
        for(int j=0; j<t.size(); j++){
            if(in[i-j] != '?' && in[i-j] != t[t.size()-1-j]){
                check = false;
                break;
            }else{
                s[i-j] = t[t.size()-1-j];
            }
        }
        if(check){
            for(int j=0; j<s.size(); j++){
                if(s[j] == '?'){
                    s[j] = 'a';
                }
                cout << s[j];
            }
            cout << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
}

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

int main () {
  int ans = 0 ;
  int pre = 0 ;
  string a ;
  int N ; 
  cin >> N ;
  cin >> a ;
  for(int i = 0 ; i< a.size() ; i++ ){
    if(a[i]=='I') pre++ ;
    else pre-- ;
    ans = max (ans , pre) ;
  }
  cout << ans << endl ;
}

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

#define ll long long int

int main() {
    int n;
    cin>>n;
    ll a[n];
    for(int i=0; i<n; i++) cin>>a[i];
    ll dp[n][n+1];
    for(int i=0; i<n; i++) dp[i][1] = 0;
    for(int l=2; l<=n; l++) {
        for(int i=0; i+l<=n; i++) {
            dp[i][l] = LLONG_MAX;
            for(int k=1; k<l; k++)
                dp[i][l] = min(dp[i][k] + dp[i+k][l-k], dp[i][l]);
            for(int k=0; k<l; k++) dp[i][l] += a[i+k];
        }
    }
    cout<< dp[0][n] <<endl;
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int s, w;
  cin >> s >> w;
  if(w >= s)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
  return 0;
}


Measured memory_bytes: 3652
package main

import (
	"fmt"
)

func main() {
	var a, b, c string
	fmt.Scan(&a, &b, &c)

	if a[len(a)-1] == b[0] && b[len(b)-1] == c[0] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1772
#include<cstdio>
#include<cstring>

int n, A;
int x[55];
long long f[55][3333];
long long ans;

int main() {
	scanf("%d%d", &n, &A);
	for(int i=1;i<=n;i++) scanf("%d", &x[i]);
	
	memset(f, 0, sizeof f);
	f[0][0] = 1;
	for(int i=1;i<=n;i++) {
		for(int cnt = i-1;cnt>=0;cnt--)
			for(int j=0;j<=n*A;j++)
				f[cnt+1][j+x[i]] += f[cnt][j];
	}
	ans=0LL;
	for(int i=1;i<=n;i++)
		ans+=f[i][i*A];
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 1536
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN2(x,a);
  if(x < a) OUT(0);
  else OUT(10);
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int x, a; cin >> x >> a;
  cout << (x < a ? 0 : 10) << '\n';
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int> si;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for(ll i{s}; i < N; i++)
using namespace std;
using ll = long long;
using iikae = ll&;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll N, M;
  cin >> N >> M;
  ll maxL{}, minR{N};
  rep(i, 0, M){
    ll L, R;
    cin >> L >> R;
    maxL = max(L, maxL);
    minR = min(R, minR);
  }
  cout << max(minR - maxL + 1, 0LL) << rt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,aa[110000];
pair<int,int> p[110000];
string s;
char c;
signed main(){
	cin>>n>>m;
    cout<<(n+m-1)/m;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) - 1 for _ in range(n)]

ans = 0
c = 0
while c != 1 and c != -1:
    c_old = c
    c = a[c]
    a[c_old] = -1
    ans += 1


if c == -1:
    ans = -1

print(ans)


Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

typedef vector<int> VI;
typedef pair<int, int> pii;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

const int N = 100000 + 5;
int n, m, fl, col[N];
LL cnt2, cnt1, cnt3, sz;
VI E[N];

void dfs(int x, int c) {
	if (col[x]) {
		if (col[x] != c) fl = 0;
		return;
	}
	++sz; col[x] = c;
	RVC(i, E[x]) dfs(E[x][i], 3 - c);
}

int main() {
	read(n), read(m);
	for (int i = 1, u, v; i <= m; i++) {
		read(u), read(v);
		E[u].pb(v), E[v].pb(u);
	}
	LL ans = 0;
	for (int i = 1; i <= n; i++)
		if (!col[i]) {
			fl = 1; sz = 0;
			dfs(i, 1);
			if (sz == 1) ++cnt1;
			else if (fl) ++cnt2;
			else ++cnt3;
		}
	ans += 1ll * cnt1 * (n - cnt1) * 2 + cnt1 * cnt1;
	ans += cnt2 * cnt2 * 2;
	ans += cnt3 * cnt2 * 2 + cnt3 * cnt3;
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
    long long n, m; cin >> n >> m;
    vector<pair<long long, long long>> d(n);
    for (int i=0; i<n; ++i) {
        long long a, b; cin >> a >> b;
        d[i] = make_pair(a, b);
    }
    sort(d.begin(), d.end());
    long long ans = 0;
    int now = 0;
    while (m>=0) {
        long long num = d[now].second;
        long long price = d[now].first;
        if (m < num) {
            ans += price * (long long)m;
            break;
        }
        else {
            ans += price * num;
            m -= num;
        }
        now++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    cout<<a.back()-a.front()<<endl;
    return 0;
}

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

int n;
int a[1000006];
int flg_p[1000006];
int cnt_a[1000006];

vector<int> list_input;
vector<int> list_prime;
int list_input_size,list_prime_size;

map<int,int> mp;

bool flg_pairwise = true;
bool flg_setwise = true;

void init(){
	list_prime.push_back(2);
	flg_p[0]=flg_p[1]=true;
	for(int i=2;i<=1003;i+=2){
		flg_p[i] = true;
	}
	for(int i=3;i<=1003;i+=2){
		bool tf = false;
		for(int j=3;j<=sqrt(i) && flg_p[i]==false;j++){
			if(i%j == 0 && i!=j){
				tf = true;
				break;
			}	
		}
		if(tf==false){
			list_prime.push_back(i);
			for(int j=i;j<=1003;j+=i){
				flg_p[j] = true;
			}
		}
	}
	/*
	for(int i=0;i<list_prime.size();i++){
		cout<<list_prime[i]<<endl;
	}
	*/
}

int main(){

	init();

	for(int i=0;i<1000006;i++){
		cnt_a[i] = 0;
		flg_p[i] = false;
	}

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		cnt_a[a[i]]++;
		if(cnt_a[a[i]]==1){
			list_input.push_back(a[i]);
		}
		else if(a[i] != 1){
			flg_pairwise = false;
		}
	}

	// soinsu bunkai
	list_input_size = list_input.size();
	list_prime_size = list_prime.size();
	for(int i=0;i<list_input_size;i++){
		int t = list_input[i];
		int c = 0;
		while(t != 1){
			int tmp = 1;
			if(c==list_prime_size){
				tmp = t;
			}
			else{
				tmp = list_prime[c];
			}

			if(t%tmp==0){
				//cout<<list_prime[c]<<endl;
				if(mp.count(tmp) != 0){
					flg_pairwise = false;
					mp[tmp] = mp[tmp]+1;
				}
				else{
					mp[tmp] = 1;
				}

				if(mp[tmp] == list_input_size){
					flg_setwise = false;
				}
			
				while(t%tmp==0){
					t /= tmp;
				}
			}
			c++;
		}
	}

	if(flg_pairwise == true)cout<<"pairwise coprime"<<endl;
	else if(flg_setwise == true)cout<<"setwise coprime"<<endl;
	else cout<<"not coprime"<<endl;

	return(0);
}

Measured memory_bytes: 22388
import sys
m,d=map(int,input().split())

if d<22:
    print("0")
    sys.exit(0)

cnt = 0
for i in range(1,m+1):
    for j in range(1,d+1):
        j_10=int(j/10)
        j_1=j-j_10*10
        #print(i,j,j_10,j_1)
        if (j_1>=2) and (j_10>=2) and (j_1*j_10==i):
            cnt += 1
            
print(cnt)

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

typedef long long int llint;

int p[10000000];
int b[10000000] = {};
int e[10000000] = {};


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

  for(int i = 1; i <= n; i++) cin>> p[i];

  int mx = 0;

  for(int i = 1; i <= n; i++) {
    int tmp = b[p[i]] = b[p[i] - 1] + 1;
    mx = max(mx, tmp);
  }
  
  for(int i = n; i >= 1; i--) {
    int tmp = e[p[i]] = e[p[i] + 1] + 1;
    mx = max(mx, tmp);
  }
  
  
  cout<< n - mx <<endl;
  
  return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  int ans;
  if(A>=13){
    ans = B;
  }
  else if(A<6){
    ans = 0;
  }
  else{
    ans=B/2;
  }
  cout << ans << endl;
}

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

int main()
{
    //freopen("in.inp", "r", stdin);
    long long int n, w;
    cin >> n >> w;
    long long int m[n+1], v[n+1], f[n+1][w+1];
    for(int i=1; i<=n; i++)
    {
        cin >> m[i] >> v[i];
    }

    for(int i=0; i<=n; i++)
    {
        f[i][0] = 0;
    }
    for(int i=1; i<=w; i++)
    {
        f[0][i] = 0;
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=w;j++)
        {
            if(m[i]<=j)
            {
                f[i][j]=max(f[i-1][j-m[i]]+v[i],f[i-1][j]);
            }
            else
            {
                f[i][j]=f[i-1][j];
            }
        }
    }
    cout << f[n][w] << endl;
//    int j=w;
//    for(int i=n; i>=1; i--)
//    {
//        if(f[i][j]!=f[i-1][j])
//        {
//            c[i] = i;
//            j = j - m[i];
//        }
//    }
//    for(int i=1; i<=n; i++)
//    {
//        if(c[i]!=0)
//        {
//            cout << c[i] << " ";
//        }
//    }
    return 0;
}

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

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

  int ans = 0;
  rep(i, s.size() / 2)
  {
    if (s.at(i) == s.at(s.size() - (i + 1)))
      continue;

    ans++;
  }
  cout << ans << endl;
}


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

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

    vector<int> a(n);
    int l = 0, r = 0;
    rep(i, n)
    {
        cin >> a[i];
        r = max(r, a[i]);
    }

    while (r - l > 1)
    {
        int m = l + (r - l) / 2;
        int sum = 0;
        rep(i, n)
        {
            sum += (a[i] - 0.5) / m;
            if (sum > k)
                break;
        }
        if (sum > k)
            l = m;
        else
            r = m;
    }
    cout << r << endl;
}

Measured memory_bytes: 4016
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int n;
cin >> n;

int sum = 0;
int m = -1;

rep(i,n){
    int a;
    cin >> a;
    m = max(m,a);
    sum += a;
}

int ans = sum - (m / 2);
cout << ans << endl;

return 0;
}

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

int main()
{
	map<string, int> mp;
	string s;
	string max, len;
	
	while (cin >> s){
		mp[s]++;
		if (mp[max] < mp[s]){
			max = s;
		}
		else if (len.size() < s.size()){
			len = s;
		}
	}
	
	cout << max << ' ' << len << endl;
	
	return (0);
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void ok() { cerr << "ok" << endl; }
using D = double;
using Point = complex<D>;
const D eps = 1e-40;
inline int sgn(const D &a) { return (a < -eps) ? -1 : (a > eps) ? 1 : 0; }
inline D cross(const Point &a, const Point &b) {
    return a.real() * b.imag() - a.imag() * b.real();
}
inline D dot(const Point &a, const Point &b) {
    return a.real() * b.real() + a.imag() * b.imag();
}
istream &operator>>(istream &is, Point &p) {
    D a, b;
    is >> a >> b;
    p = Point(a, b);
    return is;
}
inline int ccw(const Point &a, const Point &b, const Point &c) {
    D d = cross(b - a, c - a);
    if (sgn(d) > 0) {
        return +1; //anti-clockwise
    } else if (sgn(d) < 0) {
        return -1; //clockwise
    } else {
        if (sgn(dot(b - a, c - a)) < 0) {
            return -2;
        } else if (sgn(dot(a - b, c - b)) < 0) {
            return +2;
        }
    }
    return 0;
}
inline Point projection(const Point &p, const Point &a, const Point &b) { //a to b
    return p + (dot(a - p, b - p) / norm(a - p)) * (a - p);
}
inline Point reflection(const Point &p, const Point &a, const Point &b) {
    return b + (projection(p, a, b) - (b - p)) * static_cast<D>(2.0);
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    Point p, a;
    cin >> p >> a;
    int q;
    cin >> q;
    while (q--) {
        Point b;
        cin >> b;
        Point to = projection(p, a, b);
        cout << fixed << setprecision(20) << to.real() << " " << to.imag() << endl;
    }
}



Measured memory_bytes: 3376
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int h,n;
  cin >> h >> n;
  vector<vector<int>> e(h,vector<int>(4,0));
  rep(i,n){
    int x,y;
    cin >> x >> y;
    e[y][x]=1;
  }
  vector<vector<int>> a(h,vector<int>(5,0));
  for (int i=1;i<h;i++){
    rep(j,5){
      a[i][0]=max(a[i][0],a[i-1][j]);
    }
    bool t=true;
    rep(j,4){
      if (e[i-1][j]==1 || e[i][j]==1) t=false;
    }
    if (t) a[i][1]=a[i-1][0]+2;
    rep(j,3){
      t=true;
      rep(k,2){
        if (e[i-1][j+k]==1 || e[i][j+k]==1) t=false;
      }
      if (t){
        if (j==0){
          a[i][2]=max(a[i-1][0],a[i-1][4])+1;
        }
        if (j==1){
          a[i][3]=a[i-1][0]+1;
        }
        if (j==2){
          a[i][4]=max(a[i-1][0],a[i-1][2])+1;
        }
      }
    }
  }
  int ans=0;
  rep(i,5) ans=max(ans,a[h-1][i]);
  cout << ans << endl;
}



Measured memory_bytes: 3900
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;

    if (S == U) {
        cout << A - 1 << " " << B;
    } else {
        cout << A << " " << B - 1;
    }
}


Measured memory_bytes: 256
using System;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] data = new int[input.Length];
            for(int i = 0; i < input.Length; i++)
            {
                data[i] = int.Parse(input[i]);
            }

            Array.Sort(data);
            Console.WriteLine(data[0] + data[1]);
        }
    }
}


Measured memory_bytes: 11220
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
 
namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
 
        static string Solve(string S, int K)
        {
            var s = S.ToCharArray();
            s[K - 1] = char.ToLower(s[K - 1]);
            return new string(s);
        }
        static void Main(string[] args)
        {
            var V = ReadInts();
            var S = Read();
            Console.WriteLine(Solve(S, V[1]));
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m,l,r;
    cin>>n>>m;
    if(n>12)
    {
        cout<<m<<"\n";
    }
    else if(n>5)
    {
        cout<<m/2<<"\n";
    }
    else
    {
        cout<<"0\n";
    }
    return 0;
}



Measured memory_bytes: 3608
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from bisect import bisect_left

N,E,T = map(int,readline().split())
X = [0] + list(map(int,read().split()))

half = T//2
I = [bisect_left(X,x-half) for x in X]

INF = 10**18

def base_solution():
    # これをseg木に乗せまーす
    dp = [0] * (N+1)
    for n in range(1,N+1):
        x = X[n]
        i = I[n]
        # i-1番目まで戻る → 待ち時間なし
        # i番目まで戻る → 待ち時間発生
        if i >= 1:
            t1 = min((dp[k]-X[k] for k in range(i-1,n)),default=INF)+x+T
            t2 = min((dp[k]-X[k]-2*X[k+1] for k in range(i-1)),default=INF)+3*x
        else:
            t1 = min((dp[k]-X[k] for k in range(n)),default=INF)+x+T
            t2 = INF
        dp[n] = min(t1,t2)
    answer = dp[N] + (E-X[-1])
    print(answer)

class MinSegTree():
    def __init__(self,N):
        self.Nelem = N
        self.size = 1<<(N.bit_length()) # 葉の要素数
        
    def build(self,raw_data):
        # raw_data は 0-indexed
        INF = 10**18
        self.data = [INF] * (2*self.size)
        for i,x in enumerate(raw_data):
            self.data[self.size+i] = x
        for i in range(self.size-1,0,-1):
            x = self.data[i+i]; y = self.data[i+i+1]
            self.data[i] = x if x<y else y
    
    def update(self,i,x):
        i += self.size
        self.data[i] = x
        i >>= 1
        while i:
            x = self.data[i+i]; y = self.data[i+i+1]
            self.data[i] = x if x<y else y
            i >>= 1
    
    def get_value(self,L,R):
        # [L,R] に対する値を返す
        L += self.size
        R += self.size + 1
        # [L,R) に変更
        x = 10**18
        while L < R:
            if L&1:
                y = self.data[L]
                if x > y: x = y
                L += 1
                
            if R&1:
                R -= 1
                y = self.data[R]
                if x > y: x = y
            L >>= 1; R >>= 1
        return x

dp1 = MinSegTree(N+1) # dp[k]-X[k] を格納する
dp2 = MinSegTree(N+1) # dp[k]-X[k]-2X[k+1] を格納する
dp1.build([0]*(N+1))
dp2.build([0]*(N+1))
dp2.update(0,-2*X[1])
X.append(E)
for n in range(1,N+1):
    x = X[n]; i = I[n]
    if i >= 1:
        t1 = dp1.get_value(i-1,n-1)+x+T
        t2 = dp2.get_value(0,i-2)+3*x
        t = t1 if t1<t2 else t2
    else:
        t = dp1.get_value(0,n-1)+x+T
    dp1.update(n,t-x)
    dp2.update(n,t-x-2*X[n+1])
answer = t+E-x
print(answer)

Measured memory_bytes: 74836
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(true){
     int H = scan.nextInt();
        int W = scan.nextInt();
if(H == 0 && W == 0)break;

for(int i = 0; i < H; i++){
    for(int x = 0; x < W;  x++){
      if( i % 2 == 0 && x % 2 == 0 || i % 2 ==1 && x % 2 ==1){
          System.out.print("#");
      }else {
          System.out.print(".");
      }
       
    }
  System.out.println();
}
System.out.println();
}
        
    }
}


Measured memory_bytes: 37124
#include <bits/stdc++.h>
    using namespace std;
	typedef long long int ll; 
	
	ll gcd(ll a, ll b){
	    if(b==0){
	        return a;
	    }
	    return gcd(b,a%b); 
	}
     
    int main() {
        int N;
        cin >> N;
        vector<ll> A(N);
      
        for (int i = 0; i < N; i++) { 
       		 cin >> A.at(i); 
        }
        
        vector<ll> B(N);
        vector<ll> C(N);
        
        B.at(0)=A.at(0); 
        for(int i=1; i < N; i++ ){
            B.at(i)= gcd(B.at(i-1),A.at(i));
            //cout<< B.at(i) << endl;
        }
        
        
        C.at(N-1) = A.at(N-1);
        for(int i=N-2; i >= 0; i-- ){
            C.at(i)= gcd(C.at(i+1),A.at(i));
            //cout<< C.at(i) << endl;
        }
        
        ll answer= max( B.at(N-2), C.at(1));
        
        for(int i=1; i < N-1; i++ ){
            answer = max( answer, gcd( B.at(i-1), C.at(i+1) ) );
        }
        
        cout<< answer; 
        
        

   }

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

int main (void) {
    int n;
    scanf("%d", &n);

    set<int> s;
    for (int i = 0; i < n; i++) {
        int d;
        scanf("%d", &d);
        s.insert(d);
    }
    
    printf("%d", s.size());
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;

int main(void){
    int r,n;
    int i,j,k;
    int xl,xr,h;
    int b[40][21];
    double min,d;
    while(1){
        cin >> r >> n;
        if(r == 0) break;
        for(i = 0;i < 40;i++){
            for(j = 0;j < 21;j++){
                b[i][j] = 0;
            }
        }
        for(i = 0;i < n;i++){
            cin >> xl >> xr >> h;
            xl += 20;
            xr += 20;
            for(j = xl;j < xr;j++){
                for(k = 0;k < h;k++){
                    b[j][k] = 1;
                }
            }
        }
        min = 10000;
        for(i = -r+1;i < r;i++){
            for(j = 0;j < 21;j++){
                if(b[i+19][j] == 0 || b[i+20][j] == 0){
                    d = j+r-sqrt(r*r-i*i);
                    if(min > d) min = d;
                }
            }
        }
        cout << min << endl;
    }
}

Measured memory_bytes: 1240