akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(I,N) for (int I=0; I<N; I++)
#define fornd(I,N) for (int I=N-1; I>=0; I--)
#define forab(I,A,B) for (int I=A; I<=B; I++)
#define forabd(I,A,B) for (int I=B; I>=A; I--)
#define FOREACH(I,A) for (__typeof__(A)::iterator I=A.begin(); I<A.end(); I++)
#define pb push_back
#define mp make_pair

typedef long long int ll;

const ll mod = 1000000007;

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

  int n1 = (S[0] - '0') * 10 + (S[1] - '0');
  int n2 = (S[2] - '0') * 10 + (S[3] - '0');

  if (n1 > 0 && n1 <= 12 && (n2 > 12 || n2 <= 0)) {
    cout << "MMYY" << endl;
  } else if ((n1 <= 0 || n1 > 12) && n2 > 0 && n2 <= 12) {
    cout << "YYMM" << endl;
  } else if (n1 > 0 && n1 <= 12 && n2 > 0 && n2 <= 12) {
    cout << "AMBIGUOUS" << endl;
  } else {
    cout << "NA" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	ll n;
	cin>>n;
	ll a, c = 0, l, ans = n;
	vector<pair< ll, pair< ll, ll > > > v;
	forn(i, 0, n){
		cin>>a>>l;
		v.pb(mp(a+l, mp(a, l)));
	}
	sort(all(v));
	c = v[0].F;
	forn(i, 1, n){
		// cout<<c<<" "<<v[i].F-v[i].S<<endl;
		if(v[i].S.F-v[i].S.S<c){
			ans--;
		}
		else{
			c=v[i].F;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6364
#include<stdio.h>

void devide(int x, int y, int z)
{
    if((x == 100) || (y == 100) || (z == 100)) {
        printf("A\n");
    } else if ((x + y) >= 90*2) {
        printf("A\n");
    } else if ((x + y + z) >= 80*3) {
        printf("A\n");
    } else if ((x + y + z) >= 70*3) {
        printf("B\n");
    } else if ((x + y + z) >= 50*3) {
        if ((x >= 80) || (y >= 80)){
            printf("B\n");
        } else {
            printf("C\n");
        }
    } else {
        printf("C\n");
    }
}

int main(void)
{
    int pm, pe, pj, num;

    scanf("%d", &num);

    while (num != 0) {
        for (int i = 0; i < num; i++) {
            scanf("%d %d %d", &pm, &pe, &pj);
            devide(pm, pe, pj);
        }

        scanf("%d", &num);
    }

    return 0;
}

Measured memory_bytes: 1012
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(long[] xs) {
    auto n = xs.count!(e => e < 0);
    if (n % 2 == 0) {
        return xs.map!(abs).sum;
    }
    else {
        auto m = xs.map!(abs).reduce!(min);
        return xs.map!(abs).sum - 2 * m;
    }
}

void main() {
    readint;
    auto xs = reads!long;
    writeln(calc(xs));
}


Measured memory_bytes: 4484
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		for(int i = 0; i < n; i++){
			String str1 = br.readLine();
			String str2 = br.readLine();
			
			//System.out.println(LCSReccursive(str1, str2));
			System.out.println(LCSDP(str1, str2));
		}
	}
	static int LCSDP(String str1, String str2){
		int[][] DPResult = new int[str1.length()+1][str2.length()+1];
		
		for(int i = 0 ; i <= str1.length() ; i++){
			Arrays.fill(DPResult[i], 0);
		}
		
		for(int i = 1; i <= str1.length() ; i++){
			for(int j = 1; j <= str2.length() ; j++){
				if(str1.charAt(i-1) == str2.charAt(j-1)){
					DPResult[i][j] = DPResult[i-1][j-1] + 1;
				}
				else if(DPResult[i-1][j] >= DPResult[i][j-1]){
					DPResult[i][j] = DPResult[i-1][j];
				}
				else {
					DPResult[i][j] = DPResult[i][j-1];
				}
				
				//System.out.print(DPResult[i][j] + " ");
			}
			//System.out.println();
		}
		
		
		
		
		return DPResult[str1.length()][str2.length()];
		
	}
	
	static int LCSReccursive(String str1, String str2){
		//System.out.println("compare "+str1+" and "+str2);
		if(str1.length() == 0 || str2.length() == 0){
			return 0;
		}
		else if (str1.charAt(str1.length() - 1) == str2.charAt(str2.length() - 1)){
			return LCSReccursive(str1.substring(0, str1.length() - 1), str2.substring(0, str2.length() - 1)) + 1;
		}
		else {
			return Math.max(LCSReccursive(str1, str2.substring(0, str2.length() - 1)), LCSReccursive(str1.substring(0, str1.length() - 1), str2));
		}
	}

}

Measured memory_bytes: 64464
import java.util.*;

public class Main {

    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int arr[][] = new int[n][3];
        for(int i=0;i<n;i++){
            arr[i][0] = in.nextInt();
            arr[i][1] = in.nextInt();
            arr[i][2] = in.nextInt();
        }
        int dp1[] = new int[n];
        int dp2[] = new int[n];
        int dp3[] = new int[n];
        dp1[0] = arr[0][0];
        dp2[0] = arr[0][1];
        dp3[0] = arr[0][2];
        for(int i=1;i<n;i++){
            dp1[i] = Math.max(dp2[i-1],dp3[i-1]) + arr[i][0];
            dp2[i] = Math.max(dp1[i-1],dp3[i-1]) + arr[i][1];
            dp3[i] = Math.max(dp2[i-1],dp1[i-1]) + arr[i][2];
        }
        System.out.println(Math.max(Math.max(dp1[n-1],dp2[n-1]),dp3[n-1]));

    }

}

Measured memory_bytes: 96320
data class AB(val a: Int, val b: Int) {
    constructor(pc: List<Int>): this(pc[0], pc[1])
}
fun main(arg: Array<String>) {
    var (N, H) = listOfInt()
    val AB = Array(N) { AB(listOfInt()) }.sortedBy { -it.b }.toTypedArray()
    val maxA = AB.maxBy { it.a }!!.a
    var ans = 0
    var n = 0
    while (n < N && 0 < H && maxA < AB[n].b) {
        H -= AB[n].b
        ans += 1
        n += 1
    }
    if (H > 0) ans += (H + (maxA - 1)) / maxA
    println(ans)
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


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

int main(void){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
    int n,ans=0,now,old=0,c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>now;
        if(old>=now) c++;
        else{
            if(ans<c) ans=c;
            c=0;
        }
        old=now;
    }
    cout<<(c>ans?c:ans)<<endl;
}


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

using namespace std;

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

  int n,k,i,m;
  vector <int> v;
  
  scanf("%d%d",&k,&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&m);
    v.emplace_back(m);
  }
  
  m = v[0];
  for(i=1;i<n;i++){
    m = max(m,abs(v[i]-v[i-1]));  
  }
  
  m = max(m,v[0]-v[n-1]+k);
  
  printf("%d",k-m);

  return 0;
}


Measured memory_bytes: 1400
#include <set>
#include <cstdio>
#include <iostream>
#include <algorithm>
typedef long long ll;
typedef std::pair<int,int> pii;

int n;
ll Ans=1e18;
std::multiset<pii> s;
std::multiset<int> sr,sb;

inline void Update(){Ans=std::min(Ans,(*sr.rbegin()-*sr.begin())*ll(*sb.rbegin()-*sb.begin()));}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    {
        pii x;
        scanf("%d%d",&x.first,&x.second);
        if(x.first>x.second)std::swap(x.first,x.second);
        s.insert(x),sr.insert(x.first),sb.insert(x.second);
    }
    Update();
    for(auto r:s)
    {
        int x=r.first,y=r.second;
        sr.erase(sr.find(x)),sr.insert(y);
        sb.erase(sb.find(y)),sb.insert(x);
        Update();
    }
    printf("%lld\n",Ans);
    return 0;
}

Measured memory_bytes: 28416
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
m = map(int, read().split())
AB = zip(m, m)

MOD = 10 ** 9 + 7

graph = [[] for _ in range(N + 1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)

root = 1
parent = [0] * (N + 1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

fact = [1] * (N + 10)
for n in range(1, N + 10):
    fact[n] = n * fact[n - 1] % MOD
fact_inv = [1] * (N + 10)
fact_inv[-1] = pow(fact[-1], MOD - 2, MOD)
for n in range(N + 9, 0, -1):
    fact_inv[n - 1] = fact_inv[n] * n % MOD

size_d = [0] * (N + 1)
dp_d = [1] * (N + 1)

for v in order[::-1]:
    dp_d[v] *= fact[size_d[v]]
    dp_d[v] %= MOD
    p = parent[v]
    s = size_d[v] + 1
    size_d[p] += s
    dp_d[p] *= fact_inv[s] * dp_d[v]
    dp_d[p] %= MOD

size_u = [N - 2 - x for x in size_d]
dp_u = [1] * (N + 1)

for v in order[1:]:
    p = parent[v]
    x = dp_d[p]
    x *= dp_u[p]
    x *= fact_inv[size_d[p]]
    x *= fact[size_d[v] + 1]
    x *= pow(dp_d[v], MOD - 2, MOD)
    x *= fact[size_u[v]]
    x *= fact_inv[size_u[p] + 1]
    dp_u[v] = x % MOD

for xd, xu, sd, su in zip(dp_d[1:], dp_u[1:], size_d[1:], size_u[1:]):
    su += 1
    x = xd * xu * fact[sd + su] * fact_inv[sd] * fact_inv[su] % MOD
    print(x)


Measured memory_bytes: 89204
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
  long N; cin >> N;
  long lN = (long)sqrt(N);
  vector<long> rN;
  for (long i = 1; i <= lN; i++) {
    if (N % i == 0) { rN.push_back(i); }
  }
  rN.push_back(N);

  // check
  int ans = lN + 1;
  for (ll A = 1; A * A <= N; ++A) {
    if (N % A != 0)
      continue;
    const ll B = N / A;
    // cout << A << " " << B << endl;
    long fAB = max((long)log10(A) + 1, (long)log10(B) + 1);
    if (ans > fAB) { ans = fAB; }
  }
  cout << ans << endl;
}


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

int main()
{
	long long n, k;
	cin >> n >> k;
	n = n % k;
	long long min = n;
	long long old_n = n;
	do
	{
		// cout << n << " " << min << endl;
		old_n = n;
		n = abs(n - k);
		if(n < min)
		{
			min = n;
		}
	}while(old_n > n);
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
using namespace std;
using ll = long long;

const int MAX = 1000000;

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

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

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

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

int main()
{

  //cout << fixed << setprecision(10);

  int a,b; cin >> a >> b;
  cout << (a+b)%24 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
int sigma(int n){
    int sum=0;
    for (int i=1; i<=(n); i++){
        sum+=i;
    }
    return sum;
}
int distance(int yo,int xo,int yi,int xi){
    return (yo-yi)*(yo-yi)+(xo-xi)*(xo-xi);
}
signed main(){
    int N,A,B;
    cin >> N >> A >> B;
    int temp;
    int Ans =0;
    if((B-A)%2==0){
        int k=(B-A)/2;
        Ans = k;
    }
    else{
        int k = 1+(B-A)/2 + min((N-B),(A-1));
        Ans = k;
    }

    cout << Ans << endl;
    return 0;
}


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

using namespace std;

vector<long long int> pnum_vec;
vector<long long int> tnum_vec;

long long int patty(const long long int n, const long long int x) {
    if(n == 0) {
        if(x == 0) {
            return 0;
        } else {
            return 1;
        }
    } else if(x <= 1) {
        return 0;
    } else if(x < tnum_vec.at(n-1)+1) {
        return patty(n-1, x-1);
    } else if(x == tnum_vec.at(n-1)+1) {
        return pnum_vec.at(n-1);
    } else if(x == tnum_vec.at(n-1)+2) {
        return pnum_vec.at(n-1) + 1;
    } else if(x <=  2 * tnum_vec.at(n-1) + 2) {
        return pnum_vec.at(n-1) + 1 + patty(n-1, x-tnum_vec.at(n-1) - 2);
    } else {
        return 2 * pnum_vec.at(n-1) + 1;
    }
}

int main(void) {
    long long int N, X;
    cin >> N >> X;
    long long int pnum = 1; pnum_vec.push_back(pnum);
    long long int tnum = 1; tnum_vec.push_back(tnum);
    for(long long int i=1; i<=N; i++) {
        pnum = 2 * pnum + 1;
        tnum = 2 * tnum + 3;
        pnum_vec.push_back(pnum);
        tnum_vec.push_back(tnum);
    }
    cout << patty(N, X) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n , n_1 , n_2 , n_3 , n_4;
  cin >> n;
  n_1 = n / 1000;
  n_2 = (n / 100) % 10;
  n_3 = (n / 10) - (n_1 * 100 + n_2 * 10);
  n_4 = n - (n_1 * 1000 + n_2 * 100 + n_3 * 10);
  
  if (n_1 == n_2 && n_2 == n_3) {
    cout << "Yes" << endl;
  }
  else if (n_2 == n_3 && n_3 == n_4) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main(){
    long long x, y;
    cin >> x >> y;

    vector<long long> a;

    a.push_back(x);
    
    long long i = 0;
    long long b = 0;
    while(1){
        b = 2*a[i];
        
        if(b <= y){
            a.push_back(b);
            i++;
        }
        else{
            break;
        }
    }

    printf("%lld\n", i+1);

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
vector<pair<int,int> >G[N];
int n,m,a[N],b[N],deg[N],f[N];
int Find(int x)
{
    if(x==f[x]) return x;
    return f[x]=Find(f[x]);
}
void dfs(int u,int f)
{
    for(auto p:G[u])
    {
        int v=p.first,id=p.second;
        if(v==f) continue;
        dfs(v,u);
        if(deg[v]%2==0)
            deg[u]++,a[id]=u,b[id]=v;
        else
            deg[v]++,a[id]=v,b[id]=u;
    }
}
int main()
{
    scanf("%d%d",&n,&m);
    if(m%2) {printf("-1\n");return 0;}
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
        if(Find(a[i])!=Find(b[i]))
        {
            G[a[i]].push_back({b[i],i});
            G[b[i]].push_back({a[i],i});
            f[Find(a[i])]=Find(b[i]);
        }
        else deg[a[i]]++;
    }
    dfs(1,0);
    for(int i=0;i<m;i++)
        printf("%d %d\n",a[i],b[i]);
    return 0;
}

Measured memory_bytes: 15104
#include<iostream>
typedef  long long int ll;
using namespace std;
int sum(ll n)
{
    int d,sum=0;
    while(n!=0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
bool S(ll n)
{
    if(n%sum(n)==0) return 1;
    return 0;
}
int main()
{
    ll n;
    cin >> n;
    if(S(n)) cout << "Yes";
    else cout << "No";
}


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

int main(){
	string key;
	int n;
	string s;
	int ans = 0, i;
	
	cin >> key;
	cin >> n;
	for( i = 0; i < n; i++ ){
		cin >> s;
		s += s;
		if( s.find(key) != string::npos )
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>

using namespace std;
typedef long long int ll; typedef pair<int, int> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
bool isincluded(char x, string str) {
	bool f = 0;
	for (size_t i = 0; i < str.size(); i++) {
		if (str.at(i) == x)f = 1;
	}
	return f;
}




int main(void){
	string str; cin >> str;
	string tmp;
	rep(i, str.size()) {
		tmp.push_back(str.at(str.size()-i-1));
	}
	ll ans = 0;
	for (int i = 0; i < str.size() / 2; i++) {
		if (str.at(i) != tmp.at(i))ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (b - a == c - b) {
	cout << "YES" << endl;
  }
  else {
	cout << "NO" << endl;
  }

}

Measured memory_bytes: 256
N = gets.to_i

X = Array.new
Y = Array.new

(1..N).each do |i|
    x,y = gets.split.map(&:to_i)
    X.push(x + y)
    Y.push(x - y)
end

puts([(X.max - X.min).abs, (Y.max - Y.min).abs].max)

Measured memory_bytes: 17532
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 110;
int n,m,k; 
int a[N];
string str;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    if(n&1)cout<<n/2+1;
    else cout<<n/2;
    return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
ll nxt(){ll x;cin>>x;return x;}

const int N=3e3+5;
int dp[N][N];
const int mod=998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int n,s;
	cin>>n>>s;
	ll ans=0;
	for1(i,n){
		int x;
		cin>>x;
		dp[i][x]=i;
		for(int j=0;j<=s;j++){
			(dp[i][j]+=dp[i-1][j])%=mod;
			if(j-x>=0) (dp[i][j]+=dp[i-1][j-x])%=mod;
		}
	}
	for1(i,n) ans=(ans+dp[i][s])%mod;
	cout<<ans;
    return 0;
}



Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> Pr;
const int INF = 1 << 28;

int n, m;
int dp[101];
vector<Pr> ps;

int main()
{
	fill_n(dp + 1, 100, INF);
	
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++){
		int s, t;
		scanf("%d %d", &s, &t);
		ps.push_back(Pr(s, t));
	}
	
	sort(ps.begin(), ps.end());
	
	for (int i = 0; i < m; i++){
		for (int j = ps[i].first; j <= ps[i].second; j++){
			dp[j] = min(dp[j], dp[ps[i].first - 1] + 1);
		}
	}
	
	int res = dp[n];
	if (res != INF) printf("%d\n", res);
	else puts("Impossible");
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int N,K;
    cin>>N>>K;
    vector<int> p;
    rep(i,N){
        int t;
        cin>>t;
        p.push_back(t);
    }
    sort(all(p));
    int ans=0;
    rep(i,K){
        ans+=p.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#define MAXN 1007
#include <vector> 
using std::vector;

int main(void)
{
    vector<int> applePos,peachPos;
    char msg[MAXN];
    int i=0;
    while((msg[i]=getchar())!='\n')
    {
        i++;
    }
    msg[i]=0;
    for(i=0;msg[i];i++)
    {
        if(strncmp(msg+i,"apple",5)==0)
        {
            applePos.push_back(i);            
        }
        if(strncmp(msg+i,"peach",5)==0)
        {
            peachPos.push_back(i);
        }
    }
    for(i=0;i<applePos.size();i++)
    {
        strncpy(msg+applePos[i],"peach",5);
    }
    for(i=0;i<peachPos.size();i++)
    {
        strncpy(msg+peachPos[i],"apple",5);
    }
    printf("%s\n",msg);
    return 0;
}


Measured memory_bytes: 2492
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF = 987654321987654321;

int main()
{
	int N, K;
	ll ans = -INF;
	cin >> N >> K;
	vector<int>P(N), C(N);
	for (auto&i : P)
	{
		cin >> i;
		i--;
	}
	for (auto&i : C)cin >> i;

	for (int i = 0; i < N; i++)
	{
		int cycleN = 1, now = P[i];
		ll cycleSum = C[i];
		while (now != i)
		{
			cycleN += 1;
			cycleSum += C[now];
			now = P[now];
		}
		ll path = 0;
		int cnt = 0;
		while (true)
		{
			cnt++;
			path += C[now];
			if (cnt > K)break;
			ll score = path + max((ll)0, cycleSum)*((K - cnt) / cycleN);
			ans = max(ans, score);
			now = P[now];
			if (now == i)break;
		}
	}
	cout << ans;
}


Measured memory_bytes: 3668
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j+2)%2==0:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()



Measured memory_bytes: 7004
#include<bits/stdc++.h>
#define FileIO() freopen("in.txt","r",stdin);
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    if ((s[2]==s[3]) && s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}

int main(){
  int x,y; cin>>x>>y;
  cout<<GCD(max(x,y),min(x,y))<<endl;
}


Measured memory_bytes: 3104
import sys
from itertools import accumulate
N, M, Q = map(int, sys.stdin.readline().split())

LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
  L, R = map(int, sys.stdin.readline().split())
  LR[L-1][R-L] += 1

for i in range(N-2,-1,-1):
  for j, (acc, pre) in enumerate(zip(accumulate(LR[i]), [0]+LR[i+1])):
    LR[i][j] = acc + pre

for i in range(Q):
  p, q = map(int, sys.stdin.readline().split())
  sys.stdout.write(str(LR[p-1][q-p])+"\n")

Measured memory_bytes: 8676
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 105;
const int M = 10005;

const long long lim = 2000000000;
const long long inf = 0x3f3f3f3f3f3f3f3f;

long long G[N][N];

long long min(int a, long long b)
{
	return a < b ? a : b;
}

signed main(void)
{
	int n, m; cin >> n >> m;

	memset(G, 0x3f, sizeof(G));

	for (int i = 0; i < N; ++i)G[i][i] = 0;

	for (int i = 1; i <= m; ++i)
	{
		int x, y, w;
		cin >> x >> y >> w;
		G[x][y] = min(G[x][y], w);
	}

	for (int k = 0; k < n; ++k)
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				if (G[i][j] > G[i][k] + G[k][j])
					G[i][j] = G[i][k] + G[k][j];

	for (int i = 0; i < N; ++i)if (G[i][i] < 0)
		return cout << "NEGATIVE CYCLE" << endl, 0;

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n - 1; ++j)
			if (G[i][j] <= lim)
				cout << G[i][j] << " ";
			else cout << "INF ";
		if (G[i][n - 1] <= lim)
			cout << G[i][n - 1] << endl;
		else cout << "INF" << endl;
	}
}

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

int main()
{
	array<int, 3> A;
	cin >> A[0] >> A[1] >> A[2];
	sort(A.rbegin(), A.rend());
	cout << A[0] * 10 + A[1] + A[2] << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define inf (1000*1000*1000+9)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >


int32_t main()
{
	fast;
	
	string str;
	int cnt=0,ans=0,flag=0;
	cin>>str;
	int n=sz(str);

	rep(i,n)
	{
		if(str[i]=='B')
		{
			cnt++;
		}
		else
		{
			ans+=cnt;
		}

	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||

signed main(){
	acc_io;
	ll n,m;
	cin>>n>>m;
	vl a(n);
	ll sum=0;
	rep(i,0,n){
		cin>>a[i];
		sum+=a[i];
	}
	ll cnt=0;
	rep(i,0,n){
		if((4*m*a[i])>=sum)cnt++;
	}
	cout<<((cnt<m)?"No":"Yes")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    long long cnt=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(v[i]!=v[j] && v[j]!=v[k] && v[k]!=v[i]){
                if(v[i]+v[j]>v[k])
                {
                    cnt++;
                }
                }
            }
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 1000000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  AIN(ll,P,N);
  ll count = 0;
  for(ll i = 1; i < N - 1; i++){
    if((P[i] > P[i-1] && P[i] < P[i+1])||(P[i] < P[i-1] && P[i] > P[i+1])) count++;
  }
  OUT(count);
}

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

int main(){
  string s;cin>>s;
  sort(s.begin(),s.end());
  
  string t;cin>>t;
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  
  if (s<t) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <utility>
using namespace std;

int n,m,x;
int a[110];
int q[2]={0,0};
int main(){
    scanf("%d %d %d",&n,&m,&x);
    for (int i=0;i<m;i++){
        scanf("%d",&a[i]);
        if(a[i]<x)q[0]++;
        else q[1]++;
    }
    printf("%d\n",min(q[0],q[1]));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    int count = 0;
    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);
        if(s.size() % 2 != 0)count++;
    }
    print(count);
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, a, b int

	fmt.Scan(&n, &a, &b)

	total := 0
	for i := 0; i <= n; i++ {
		sum := 0
		val := i
		for val > 0 {
			sum += val % 10
			val /= 10
		}

		if a <= sum && sum <= b {
			total += i
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>

using namespace std;

int main(void) {

	int n,h[20]={},maxn=0,num=0;

	cin>>n;

	for (int i = 0; i < n; i++) {
		cin>>h[i];
		if(h[i]>=maxn)num++;

		maxn=max(maxn,h[i]);
	}
	cout<<num<<"\n";

	return 0;
}


Measured memory_bytes: 256
import numpy as np

m = 998244353
N, K = map(int, input().split())
span = []
for K in range(K):
    l , r = map(int, input().split())
    span.append([l, r])

add = [0,1]# 累積和
ans = [1]

for i in range(2,N+1):
    tmp = 0
    for s in span:
        l, r = s[0], s[1]+1
        if l > len(ans):
            continue
        elif r >= len(ans)+1:
            r = len(ans)+1
        tmp += (add[i-l] - add[i-r])%m
    ans.append(tmp%m)
    add.append(add[-1]+tmp)

print(ans[-1]%m)

Measured memory_bytes: 45812
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define mem(a,n) memset(a,sizeof(a),n)
typedef long long ll;
const int mod=1e9+7;
const int N=1e5+5;
const int INF=0x3f3f3f3f;
int main()
{
    string s1,s2;
    while(cin>>s1>>s2)
    {
        if(s1<s2) cout<<"<";
        else if(s1>s2) cout<<">";
        else cout<<"=";
        cout<<endl;
    }
    return 0;
}


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

static vector<int> e[100000];

int main(){
	int n, m, k;
	cin>>n>>m>>k;
	rep(i, m){
		int a, b;
		cin>>a>>b; a--; b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	vector<int> c(k), d(k);
	rep(i, k){
		cin>>c[i]>>d[i]; c[i]--; d[i]--;
	}

	vector<int> gr(n);
	rep(i, n) gr[i]=i;
	vector<bool> mita(n, false);
	vector<int> st;
	rep(i, n) st.push_back(i);
	while(!st.empty()){
		int v=st.back(); st.pop_back();
		if(mita[v]) continue;
		mita[v]=true;
		for(int u : e[v]){
			gr[u]=gr[v];
			st.push_back(u);
		}
	}

	vector<int> numb(n);
	rep(i, k) if(gr[c[i]]==gr[d[i]]){
		numb[c[i]]++;
		numb[d[i]]++;
	}

	map<int, int> ma;
	rep(i, n) ma[gr[i]]++;

	rep(i, n){
		int ans=ma[gr[i]]-e[i].size()-numb[i]-1;
		cout<<ans<<" ";
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 14096
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int n; scanf("%d", &n);
	int c[26][50] = {};
	for(int i = 0; i < n; i++){
		char s[51]; scanf("%s", s);
		for(int j = 0; s[j] != '\0'; j++) c[s[j] - 'a'][i]++;
	}
	int res[26];
	for(int i = 0; i < 26; i++) res[i] = *min_element(c[i], c[i] + n);
	for(int i = 0; i < 26; i++) for(int j = 0; j < res[i]; j++) putchar('a' + i);
	puts("");
	return 0;
}

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)

int n;
vector<pl> a;
lld dp[2001][2001];

lld solved(int left,int right){
    if(left+right == n) return 0;
    if(dp[left][right] != -1) return dp[left][right];
    lld maxv = max(solved(left+1,right)+a[left+right].first*abs(a[left+right].second-(lld)left),
                   solved(left,right+1)+a[left+right].first*abs(a[left+right].second-(lld)(n-1-right)));
    return dp[left][right] = maxv;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) fillnum(dp[i],-1);
    for (int i = 0; i < n; i++) {
        lld v;
        cin >> v;
        pl p = make_pair(v,(lld)i);
        a.push_back(p);
    }
    sort(a.begin(),a.end(),greater<pl>());
    cout << solved(0,0) << endl;
}

Measured memory_bytes: 35132
N=int(input())
A=list(map(int,input().split()))
A.sort()

F=[0]*(10**6+11)
# 0:OK/未調査 1:NG 2:調査した頂点 3:二度調査した頂点

for a in A:
    if F[a]==1:
        continue
    if F[a]==2:
        F[a]=1
        continue
    elif F[a]==0:
        F[a]=2
    k=2*a
    while k<=10**6+1:
        F[k]=1
        k+=a
            
res=0
for a in A:
    if F[a]==2:
        res+=1
print(res)

Measured memory_bytes: 132588
m =[]
f =[]
r=[]
for i in range(50):
    m_score,f_score,r_score = map(int,input().split())
    if m_score+f_score+r_score == -3:
        break
    else:
        m.append(m_score)
        f.append(f_score)
        r.append(r_score)

for j in range(len(m)):

    if m[j] == -1 or f[j] == -1:
        print("F")
    elif m[j]+f[j]>=80:
        print("A")
    elif m[j]+f[j]>=65:
        print("B")
    elif m[j]+f[j]>=50 or r[j] >=50:
        print("C")
    elif m[j]+f[j]>=30:
        print("D")
    else:
        print("F")


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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n, m; cin >> n >> m;
        vector<vector<int>> when((int)1e5 + 1);
        m++;

        int from = 1;
        while (n--) {
                int time, cost; cin >> time >> cost;
                if (m - time >= 1) when[m - time].emplace_back(cost);
        }

        ll ans = 0;
        priority_queue<int> pq;

        for (int time = m; time >= 1; time--) {
                while (when[time].size()) {
                        pq.emplace(when[time].back());
                        when[time].pop_back();
                }
                if (pq.size()) ans += pq.top(), pq.pop();
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 8516
($Q,$H,$S,$D)=glob<>;
$N=<>;
$S=4*$Q if(4*$Q<$S);
$S=2*$H if(2*$H<$S);
$D=2*$S if(2*$S<$D);
print+$N%2?$S+$D*($N>>1):$N/2*$D

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

int main(){
    int A, B; cin >> A >> B;
    A -= 1; B -= 1;
    int ans;
    if(B % A == 0){
        ans = B / A;
    }else{
        ans = B / A + 1;
    }
    cout << ans << endl;
}

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


int main(){
   
    long long S;
    long long sqs;
    long long X1,Y1,X2,Y2,X3,Y3;
    X1 = 0;
    Y1 = 0;
    cin >> S;
    sqs = sqrt(S);
    if(sqs*sqs == S){
        X2 = sqs;
        Y2 = 0;
        X3 = 0;
        Y3 = sqs;
    }else if(sqs*(sqs+1) >= S){
        X2 = sqs+1;
        Y2 = 1;
        X3 = sqs*(sqs+1) - S;
        Y3 = sqs;
    }else{
        X2 = sqs+1;
        Y2 = 1;
        X3 = (sqs+1)*(sqs+1) - S;
        Y3 = sqs+1;
    }

    
    cout << X1 << " "<< Y1 << " "<< X2 <<" " << Y2 << " "<< X3 <<" " << Y3<<endl;
    
    
    return 0;
    

}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    while(true){
      int a = scanner.nextInt();
      int b = scanner.nextInt();
      if(a == 0 && b == 0){
        break;
      }
      for(int j = 0; j < a; j++){
        if (j != 0) System.out.print("\n");
        for(int k = 0; k < b; k++){
        if((j % 2 == 0 && k % 2 == 0) || (j % 2 == 1 && k % 2 == 1)){
          System.out.print("#");
        }
        else{
          System.out.print(".");
        }
        }
      }
      System.out.println("\n");
    }
  }

}

Measured memory_bytes: 32916
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<pii> v;
    REP(i,n) {
        int x, y;
        cin >> x >> y;
        v.push_back(make_pair(x,y));
    }
    int fact = 1;
    FOR(i,2,n+1) fact *= i;
    double distsum = 0;

    vector<int> p(n);
    iota(ALL(p),0);

    do {
        FOR(i,1,n) {
            int x = v[p[i]].first - v[p[i-1]].first;
            int y = v[p[i]].second - v[p[i-1]].second;
            distsum += sqrt(pow(abs(x),2) + pow(abs(y),2));
        }
    } while (next_permutation(ALL(p)));
    double ans = distsum / fact;

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	ll H, W; scanf("%lld %lld", &H, &W);
	vector<vector<int>> a(H, vector<int>(W)); for (ll i = 0; i < H; i++) for (ll j = 0; j < W; j++) scanf("%d", &a[i][j]);
	vector<vector<int>> sum(H + 1, vector<int>(W + 1));
	for (ll i = 0; i < H; i++) {
		for (ll j = 0; j < W; j++) {
			sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];
		}
	}
	ll l = 0;
	ll r = min(H, W) + 1;
	while (r - l > 1) {
		ll mid = (l + r) >> 1;
		bool flag = false;
		for (ll i = 0; i <= H - mid; i++) {
			for (ll j = 0; j <= W - mid; j++) {
				ll cnt = sum[i + mid][j + mid] - sum[i + mid][j] - sum[i][j + mid] + sum[i][j];
				if (cnt == 0) flag = true;
			}
		}
		if (flag) l = mid;
		else r = mid;
	}
	cout << l * l << endl;
	return 0;
}



Measured memory_bytes: 18132
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    string S; cin >> S;
    char C;
    bool B=false;
    C=S.at(0);
    int ans=1;
    REP(i,S.size()){
        if(!B){
            if(S.at(i)==C){
              i++;
              if(i==S.size())break;
              ans++;
              B=true;
              continue;
            }
        }
        ans++;
        C=S.at(i);
        B=false;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3748
-- import Prelude hiding (abs)
import Control.Monad
import Control.Arrow ((&&&))
import Data.List (nub, sort, group, find)
import Data.Maybe (fromMaybe, fromJust)
import qualified Data.IntMap as M

type Counter = M.IntMap Int

main :: IO ()
main = do
    [h, w] <- (map read . words) <$> getLine
    print $ solve (h,w)

-- |
--
-- >>> solve (3,5)
-- 0
--
-- >>> solve (4,5)
-- 2
--
-- >>> solve (5,5)
-- 4
--
-- >>> solve (100000, 2)
-- 1
solve :: (Int,Int) -> Int
solve (h,w) = minimum $ map (calc (h,w)) $ yxs1 ++ yxs2
  where
    yxs1 = [(y,w) | y <- [1 .. (h-1)]]
    yxs2 = [(h,x) | x <- [1 .. (w-1)]]


calc :: (Int,Int) -> (Int,Int) -> Int
calc (h,w) (y,x) = maximum ss - minimum ss
  where ss = splitRect3 (h,w) (y,x)

splitRect3 :: (Int,Int) -> (Int,Int) -> [Int]
splitRect3 (h,w) (y,x)
  | h == y = y * x : splitRect2 (h, w - x)
  | w == x = y * x : splitRect2 (h - y, w)

splitRect2 :: (Int,Int) -> [Int]
splitRect2 (h,w)
  | dh > dw   = [h * w1, h * w2]
  | otherwise = [w * h1, w * h2]
  where
    h1 = h `div` 2
    h2 = h - h1
    w1 = w `div` 2
    w2 = w - w1
    dh = abs (h1 - h2) * w
    dw = abs (w1 - w2) * h


Measured memory_bytes: 2044
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int Mod=998244353;
int n;
#define Maxn 10000010
int two[Maxn];
int fact[Maxn],inv[Maxn];

inline int Fast_Pow(int a,int b){
	int res=1;
	while(b){
		if(b&1)res=1ll*res*a%Mod;
		a=1ll*a*a%Mod;
		b>>=1;
	}
	return res;
}
 
inline int C(int i,int j){return 1ll*fact[i]*inv[i-j]%Mod*inv[j]%Mod;}
 
int main(){
	scanf("%d",&n);
	fact[0]=1;
	for(int i=1;i<=n;++i)fact[i]=1ll*fact[i-1]*i%Mod;
	inv[0]=inv[1]=1;
	for(int i=2;i<=n;++i)inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	for(int i=2;i<=n;++i)inv[i]=1ll*inv[i-1]*inv[i]%Mod;
	int res=Fast_Pow(3,n);
	two[0]=1;
	for(int i=1;i<=n;++i){
		two[i]=two[i-1]+two[i-1];
		if(two[i]>=Mod)two[i]-=Mod;
	}
	for(int i=n/2+1;i<=n;++i)
		res=(res-1ll*C(n,i)*two[n-i+1]%Mod+Mod)%Mod;
	printf("%d\n",res);
	return 0; 
} 

Measured memory_bytes: 117376
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
int main(void){
  int a,b,c,d,sum;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(fmin(b,d)-fmax(a,c)<=0) sum=0;
  else sum=fmin(b,d)-fmax(a,c);
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <vector>

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
#define CLOSEALL() fclose(stdin), fclose(stdout)
using namespace std;

typedef long long i64;
const int MAXN = 1e5 + 10;

int N, A[MAXN];
int edgeLabel[MAXN];
vector<int> Adj[MAXN];

class no_solution: public std::exception
{
public:
	no_solution()
	{
	}

	const char * what() const noexcept
	{
		return "no solution under such constrains";
	}
};

inline void addEdge(int u, int v)
{
	Adj[u].push_back(v);
	Adj[v].push_back(u);
}

int DFS(int cur, int pre)
{
	if(Adj[cur].size() == 1)
		return A[cur];

	i64 sum = 0;
	int tmp, mx = 0;

	for(int to : Adj[cur])
	{
		if(to == pre)
			continue;
		tmp = DFS(to, cur);

		mx = max(mx, tmp);
		sum += tmp;
	}

	if(pre == 0)
	{
		if(sum % 2)
			throw no_solution();
		if(mx > sum / 2)
			throw no_solution();
		if(A[cur] != sum / 2)
			throw no_solution();
		return 0;
	}

	i64 delta = sum - A[cur];
	if(A[cur] < delta || sum < A[cur])
		throw no_solution();
	if(sum - mx < delta)
		throw no_solution();
	return (A[cur] - delta);
}

int main()
{

	int u, v;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", &A[i]);
	for (int i = 1; i < N; i++)
		scanf("%d%d", &u, &v), addEdge(u, v);

	if (N == 2)
	{
		puts(A[1] == A[2] ? "YES" : "NO");
		return 0;
	}
	try
	{
		for (int i = 1; i <= N; i++)
			if (Adj[i].size() > 1)
			{
				DFS(i, 0);
				break;
			}
		puts("YES");
	} catch (std::exception & x)
	{
		puts("NO");
	}

	return 0;
}


Measured memory_bytes: 12800