akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }
    int ans=1e9;
    for(int i=-100; i<=100; ++i){
        int sum=0;
        rep(j,n){
            sum+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,sum);
    }
    cout<<ans<<endl;
}

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

typedef vector<int> vi; 
typedef long long ll;
#define F first 
#define S second 
#define PB push_back 
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define pmod 1000000007
#define INF 1000000000000000000
#define pi atan(1)*4
#define modi 1000000

void solve(){
	
	ll n,d;
	
	cin >> n >> d;
	
	ll m = d*d;
	
	ll counter = 0,x,y;
	
	for(ll i = 0; i < n;i++){
		cin >> x >> y;
				
		if(x*x+y*y <= m){
			counter++;
		}
		
	}	
	
	cout << counter << endl;
			
}

int main(){
	
	ifstream fin ("text.in");
    ofstream fout ("text.out");   
	
	ll t = 1;
					
	while(t--) solve();
	
	return 0;
}

Measured memory_bytes: 3636
import java.util.*;

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

      long mod = 1000000007;

      long x = Long.parseLong(sc.next());
      long y = Long.parseLong(sc.next());

      long m = (2*x-y)/3;
      long n = (2*y-x)/3;

      long ans = 0;

      int flag = 1;

if((x+y)%3!=0 || m<0 ||n<0){
  flag = 0;
}
else{
//////////////////////////////////////////////
long m2 = m + n;

long ue = bikkuriP(m2,mod);
long hidari = bikkuriP(n,mod);
long migi =  bikkuriP(m2-n,mod);

long shita = (hidari*migi)%mod;

ans = ue*pinv(shita,mod,mod)%mod;
//////////////////////////////////////////////
}

  System.out.println(ans*flag);




    }
    public static long bikkuriP(long n, long mod){
      long ans = 1;
      for(long i = n;i>0;i--){
        ans = (ans*i)%mod;
      }
      return ans;
    }
    public static long pinv(long a, long b, long p){
      long r0 = a; long r1 = b;
      long x0 = 1; long x1 = 0;
      long y0 = 0; long y1 = 1;
      while(r1>0){
        long q = r0/r1;
        long r2 = r0 % r1;
        long x2 = x0 -pmult(q,x1,p)+p;
        x2 %= p;
        long y2 = y0 -pmult(q,y1,p)+p;
        y2 %= p;
        r0 = r1; r1 = r2;
        x0 = x1; x1 = x2;
        y0 = y1; y1 = y2;
      }
      return x0;
    }
    public static long pmult(long a,long b,long p){
      return (a * b) % p;
    }

}


Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        //var num = ToInt32(ReadLine());
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        WriteLine(ar[1] % ar[0] == 0 ? ar.Sum() : ar[1] - ar[0]);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


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

int main(){
	int a, b, sum, d = 1;
	while(cin >> a >> b){
		while(!(((a >= 0)&&(a <= 1000000))&&((b >= 0)&&(b <= 1000000)))){
			cout << "wrong value\n";
			cin >> a >> b;
		}
		sum = a + b;
		while((sum / 10) != 0){
			d++;
			sum /= 10;
		}
		cout << d << "\n";
		d = 1;
	}
    return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        for (var i = 0; n >= i; i++)
        {
            var p = (int)(i * 1.08);
            if (p == n)
            {
                Console.WriteLine(i);
                return;
            }
        }
        Console.WriteLine(":(");
    }
}


Measured memory_bytes: 13140
N = int(input())
A = [int(input()) for _ in range(N)]

ans = 0
for key,val in enumerate(A):
    ans += int(val/2)

    if key < N-1 and int(val/2)*2 != val and A[key+1] != 0:
        A[key+1] -= 1
        ans += 1
print(ans)

Measured memory_bytes: 80696
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int a[3], cnt[101] = {};
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] + a[1] == a[2])cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

const int N = 1e5 + 1;
set<int> rem[N];

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		rem[a].insert(b);
	}

	int answer = 0, small = n+1;
	for (int a = 1; a <= n; a++) {
		if (a == small) {
			++answer;
			small = n+1;
		}
		if (!rem[a].empty()) small = min(small, *rem[a].begin());
	}
	if (small <= n) ++answer;
	printf("%d\n", answer);
}


Measured memory_bytes: 9600
#include <iostream>
using namespace std;
#define D

#ifdef A
int main(void)
{
	cout <<"Hello World" <<endl;
	return 0;
}
#endif
#ifdef B
int main()
{
	int A;
	cin >> A;
	cout << A*A*A << endl;
	return 0;
}
#endif
#ifdef C
int main()
{
	int a, b;
	cin >> a >> b;
	cout << a *b << " " << 2 * (a + b) << endl;
	return 0;
}
#endif
#ifdef D
int main()
{
	int S;
	cin >> S;
	int h = S / 3600, m = S / 60 % 60, s = S % 60;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}
#endif

Measured memory_bytes: 3080
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define MP make_pair
typedef long long ll;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;

/*** chmax, chmin ***/
// a < b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b; 
		return true;
	}
	return false;
}
// a > b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b; 
		return true;
	}
	return false;
}
/*** chmax, chmin ここまで ***/

int max_vvi(vvi v){
  int mx=0;
  int h = v.size();
  int w = v[0].size();
  rep(i,h){
    rep(j,w){
      chmax(mx, v[i][j]);
    }
  }
  return mx;
}

void Main()
{
  	int h, w;
	cin >> h >> w;
    vvi data(h,vector<int>(w,1));
    string s;
    rep(i,h) {
      	cin >> s;
        rep(j,w){
    		if(s[j] == '.'){
            	data[i][j] = 0;
           	}
        }
    }
    
    vvi seen(h,vector<int>(w));
    vvi dist(h,vector<int>(w));
    vvi zero(h,vector<int>(w,0));
    queue<pii> q;
    int tempi,tempj,mx;
    int ans = 0;
    	 
    auto inrange = [&](int x, int y){
      return (x>=0 && x<h && y>=0 && y<w && seen[x][y] == 0);
    };
  	
  	vector<int> adjx = {1, -1, 0, 0};
  	vector<int> adjy = {0, 0, 1, -1};
    rep(i,h){
        rep(j,w){
            // bfs(i,j);
          	mx = 0;
            if(data[i][j] == 0){
                seen = data;
                dist = zero;
                seen[i][j] = 1;
                q.push(MP(i,j));
                while(!q.empty()){
                    tempi = q.front().first;
                    tempj = q.front().second;
                    q.pop();
                  	rep(k,4){
                      	int tempx = tempi+adjx[k];
                      	int tempy = tempj+adjy[k];
                  		if(inrange(tempx, tempy)) {
                        	q.push(MP(tempx, tempy));
                        	seen[tempx][tempy] = 1;
                        	dist[tempx][tempy] = dist[tempi][tempj]+1;
                          	chmax(mx, dist[tempx][tempy]);
                        }
                    }                  
                }
            	chmax(ans, mx);
            }
        }
    }
  
    cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
/*
auhtor:hbohra98
chandigarh univeristy
*/
#include<bits/stdc++.h>
#define ll long int
#define pb push_back
#define VP vector < pair < ll , ll > >
#define VI vector< ll >
#define VS vector< string >
#define mk make_pair

using namespace std;
int main(){
ll n,c=0;
cin>>n;
for(ll i=1;i<=n;i++){
  if(i<10 && i>=1)c++;
  else if(i>=100 && i<1000)c++;
  else if(i>=10000 && i<=99999)c++;
}
cout<<c;

}

Measured memory_bytes: 256
/* created   : 2019-10-26 08:50:18
 * accepted  : 2019-10-26 08:52:14
 * author    : landcold7
 */
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mt make_tuple
#ifndef LOCAL
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n; cin >> n;
  string s; cin >> s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int j = i;
    while (j < n && s[j] == s[i]) {
      j++;
    }
    ans++;
    i = j - 1;
  }
  cout << ans << '\n';
}

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


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

int main() {
  int N;
  cin >> N;
  
  int64_t ans;
  int64_t a = 1;
  int64_t b = 1;
  int64_t c = 1; 
  for(int i = 0; i < N; i++){
    a = a * 10 % 1000000007;
    b = b * 9 % 1000000007;
    c = c * 8 % 1000000007;
  }
  
  ans = (a + 1000000007 - (((b + b) % 1000000007) - c) % 1000000007) % 1000000007 ;
  cout << ans << endl;
}

Measured memory_bytes: 3604
a, b, c, x, y = gets.chop.split.map(&:to_i)

ans = [x, y].max * [a, b, c].max * 2

([x,y].max+1).times do |i|
  ans = [ i*2*c + [0, x-i].max * a + [0, y-i].max * b, ans].min
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

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

    int n;
    cin >> n;
    SegmentTree<int> seg(n, [](int a, int b){return __gcd(a, b);}, 0);
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        seg.set(i, a);
    }
    seg.build();

    int ans = 0;
    for(int i = 0; i < n; ++i){
        chmax(ans, __gcd(seg.query(0, i), seg.query(i + 1, n)));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;


int w;
int h;
vector<vector<int> > c(50, vector<int>(50));
vector<vector<bool> > reached(50, vector<bool>(50,false));

void dfs(int y, int x){
    reached.at(y).at(x) = true;

    for(int dy = -1; dy <= 1; dy++){
        for(int dx = -1; dx <= 1; dx++){
            int nx = x + dx;
            int ny = y + dy;
			if(ny < 0 || h <= ny || nx < 0 || w <= nx || c.at(ny).at(nx) == 0) continue;          
            if(reached.at(ny).at(nx)) continue;
            dfs(ny,nx);

       }
    }
    
}




int main (){
while(cin>>w>>h,w!=0&&h!=0){
	
  	
    REP(i,h){//y
        REP(j,w){//x
          	reached.at(i).at(j) = false;
            cin >> c.at(i).at(j);
        }
    }
    int ans = 0;
    REP(i,h){
        REP(j,w){
            if(!reached.at(i).at(j) && c.at(i).at(j) == 1){
                dfs(i,j);
                ans++;
            }
            
        }
    }

    cout << ans << endl;




}

    return 0;
}


Measured memory_bytes: 3388
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

int main() {
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int X, t;
	cin >> X >> t;

	if (X <= t) cout << "0\n";
	else cout << X - t << "\n";

	return 0;
}



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

using namespace std;

int main() {
	long long int n;
	cin >> n;
	long long int l, r;
	l = 0;
	r = n;
	while (r > l + 1) {
		long long int mid = (l + r) / 2;
		long long int res = (mid*(mid - 1)) / 2;
		if (n <= mid + res) {
			r = mid;
		}
		else {
			l = mid;
		}
	}
	vector<long long int> p;
	while (n > 0) {
		if (n - r >= 0) {
			p.push_back(r);
			n -= r;
			r--;
		}
		else {
			p.push_back(n);
			n = 0;
		}
		
	}
	long long int sz = p.size();
	for (long long int i = 0; i < sz; i++) {
		cout << p[sz-1-i] << endl;
	}
	return 0;
}

Measured memory_bytes: 384
s = list(str(input()))
n = len(s)
for i in range(n):
    s.pop()
    #print(''.join(s))
    if len(s)%2 != 0:
        continue
    else:
        if s[0:len(s)//2]*2 == s:
            #print(''.join(s))
            print(len(s))
            exit()


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

int main(){
  long long n,k,q;
  std::cin >> n>>k>>q;
  std::vector<long long> a;
  long long kari;
  long long score[1000001];
  for (long long i = 0; i < q; i++) {
    std::cin >> kari;
    score[kari-1]++;
  }
  for (long long i = 0; i < n; i++) {
    if(k-q+score[i]<=0)std::cout << "No" << '\n';
    else std::cout << "Yes" << '\n';
  }
  return 0;
}


Measured memory_bytes: 3200
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int ans = 1;
        if(m%n==0){
        	System.out.println(m/n);
        }
        else{
        	for(int i=2;i<m/n;i++){
        		int x = m - n * i;
        		if(x%i==0){
        			ans = i;
        		}
        	}
        	System.out.println(ans);
        }
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype (i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype (i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype (i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,
mod=1000000007;
const double pi=3.1415926535897932,
eps=1e-6;
int n,k;vector<int> v[100005];
int dfs(int x,int fa,int len,int down){
    int res=k-min(len,2)-down,cnt=0;
    rap(i,0,v[x].size()){
        int to=v[x][i];
        if(to==fa) continue;
        res=((ll)res*dfs(to,x,len+1,cnt))%mod;
        cnt++;
    }
    return res;
}
int main()
{
    scanf("%d%d",&n,&k);
    rap(i,1,n){
        int t1,t2;
        scanf("%d%d",&t1,&t2);
        v[t1].pb(t2);v[t2].pb(t1);
    }
    printf("%d",dfs(1,0,0,0));
    return 0;
}

Measured memory_bytes: 11520
import sys

inf = (1 << 31) - 1

def solve():
    n, q = map(int, sys.stdin.readline().split())

    sg = SegTree(n)

    for qi in range(q):
        c, x, y = map(int, sys.stdin.readline().split())

        if c == 0:
            sg.update(x, y)
        else:
            ans = sg.find(x, y + 1, 0, 0, 2**sg.d)
            print(ans)

        # print(sg.a)

class SegTree:
    def __init__(self, n):
        self.d = 0

        while (2**self.d) < n:
            self.d += 1

        self.a = [inf] * (2**(self.d+1) - 1)

    def update(self, i, x):
        pos = i + 2**self.d - 1
        self.a[pos] = x

        while pos > 0:
            pos = (pos - 1) // 2
            self.a[pos] = min(self.a[2*pos + 1], self.a[2*pos + 2])

        return

    def find(self, s, t, k, l, r):
        if r <= s or t <= l:
            return inf
        if s <= l and r <= t:
            return self.a[k]

        vl = self.find(s, t, 2*k + 1, l, (l + r) // 2)
        vr = self.find(s, t, 2*k + 2, (l + r) // 2, r)

        return min(vl, vr)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 11632
import java.util.Scanner;


public class Main {
//	final static int MOD = 1000000007;

	public static long ans = 0;

	public static void main(String[] args) {

//		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

//		long a = sc.nextLong();

		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();

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

		for(int i = l; i <= r; i++) {
			if(i % d == 0)
				ans++;
		}

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

//		if(f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}
}

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

int main()
{ 
   int N;
   cin>>N;
    
    double  A[N];
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }

    double B[N];
    for(int j=0; j<N;j++)
    {
        B[j]=1/A[j];
    } 

    double sum=0.0;

    for(int k=0;k<N;k++)
    {
        sum+=B[k];
    }
    double ans = 1/sum;
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> mat;

const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    int R, G, B, N; cin >> R >> G >> B >> N;
    int cnt = 0;
    REP(r, N/R+1){
        REP(g, N/G+1){
            if ((N - (r*R + g*G)) < 0) break;
            if ((N-(r*R + g*G)) % B == 0){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}

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

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N;
    cin>>N;
    int PN=(N%10*100)+(N%100/10*10)+(N/100);
    cout<<(N==PN?"Yes":"No")<<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);
        int x = scanner.nextInt();
        int a = scanner.nextInt();

        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}


Measured memory_bytes: 22996
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
a = [[0]*w for _ in range(h)]
cnt = 0
later = []
for i in range(h):
    if '#' not in s[i]: continue
    later.append(i)
    fst = False
    idx = -1
    for j in range(w):
        if not fst and not s[i][j] == '#':
            continue
        if not fst and s[i][j] == '#':
            idx = j
        if s[i][j] == '#':
            fst = True
            cnt += 1
        a[i][j] = cnt
    for j in range(idx):
        a[i][j] = a[i][idx]

for i in later:
    if i >= h-1: break
    for j in range(w):
        k = i
        while k < h-1:
            if a[k+1][j] == 0:
                a[k+1][j] = a[k][j]
                k += 1
            else:
                break
                
if later[0] != 0:
    for i in range(later[0], 0, -1):
        for j in range(w):
            a[i-1][j] = a[i][j]
for ans in a:
    print(*ans)

Measured memory_bytes: 12592
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
s=[]
for i in range(1,m):
    s.append(l[i]-l[i-1])
s.sort()
a=0
for i in range(0,m-n):
    a+=s[i]
print(a)

Measured memory_bytes: 13960
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    using ll = long long;
    using P = pair<int,int>; 
    
    int main() {
   
     int k;
     cin >> k;
     ll count = 0;
     for(int i = 1; i <= k; i++){//a
     	for(int j = 1; j <= k; j++){//b
     		for(int m = 1; m <= k; m++){//c
     			int a = i;
     			int b = j;
     			int c = m;
     			
     			int min = a;
     			if(min>=b)	min = b;
     			if(min>=c)	min = c;
     			
     			int go = 1;
     			
     			for(int h = 1; h <= min; h++){
     				if(a%h == 0 && b%h == 0 && c%h == 0) go = h;
     			}
     			count += go;
     		}
     	}
     }
     	cout << count <<'\n';
     
     return 0;
    }

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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 int INF=1001001001;

int main() {
  int64_t Q,H,S,D,N;
  cin>>Q>>H>>S>>D>>N;
  cout<<min({4*Q,2*H,S})*(N%2)+min(2*min({4*Q,2*H,S}),D)*(N/2)<<endl;
  return 0;}

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

using namespace std;

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

    vector<tuple<int, int, int> > r;
    for(int i = 0; i < n; ++i){
        int s, t, x;
        scanf("%d %d %d\n", &s, &t, &x);
        r.push_back(make_tuple(t - x, 0, x));
        r.push_back(make_tuple(s - x, 1, x));
    }
    sort(r.begin(), r.end());

    set<int> stops;
    int t = 0;
    for(int i = 0; i < q; ++i){
        int d;
        cin >> d;
        while(t < r.size() && get<0>(r.at(t)) <= d){
            if(get<1>(r.at(t)) == 0){
                stops.erase(get<2>(r.at(t)));
            }else{
                stops.insert(get<2>(r.at(t)));
            }
            t++;
        }
        int ans = -1;
        if(!stops.empty()){
            ans = *stops.begin();
        }
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 16236
#include<iostream>
#include<cstdio>
#include<string>
#define ll long long
using namespace std;
ll n, sum;
int main(){
	while(cin >> n)
	{
		sum = 0;
		sum += n / 500 * 1000 + (n - n / 500 * 500) / 5 * 5;
		cout << sum << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    string str;
    double a, b;
    while(getline(cin, str)){
        stack<double> num;
        stringstream ss(str);
        string tmp;
        while(ss>>tmp)
        {
            if(tmp=="+"||tmp=="-"||tmp=="*"||tmp=="/")
            {
                b = num.top();
                num.pop();
                a = num.top();
                num.pop();
                if(tmp=="+") num.push(a+b);
                else if(tmp=="-") num.push(a-b);
                else if(tmp=="*") num.push(a*b);
                else num.push(a/b);
            }
            else num.push(atof(tmp.c_str()));
        }
        printf("%.6f\n",num.top());
    }
}

Measured memory_bytes: 1276
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<pair<int, int>> vpi;
typedef vector<tuple<int, int, int>> vti;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int a, b;
    cin >> a >> b;
    
    if (abs(a - b) % 2 == 1){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    int max_x = max(a, b);
    int ans = max_x - (abs(a - b) / 2);
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);

            Console.WriteLine(Math.Max(0, A - 2 * B));
        }
    }
}



Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <set>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;


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

    cout << S.substr(0, 3) << endl;
}


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int H,W;
  cin >> H >> W;
  vector<string> v(H);
  for(int i = 0; i < H; i++) cin >> v[i];

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      bool flg1, flg2;
      // flg1: 下が#
      flg1 = (i+1<H && v[i+1][j] == '#');
      // flg2: 右が#
      flg2 = (j+1<W && v[i][j+1] == '#');

      if(flg1 && flg2){
        cout << "Impossible" << endl;
        return 0;
      }
    }
  }
  cout << "Possible" << endl;
}


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

int main() {
	int x, i;
	i = 1;
	
	while (true) {
		cin >> x;
		if (x == 0)  break;
		cout << "Case " << i << ": " << x <<'\n';
		++i;
			}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int a,b,c,d;
    cin >> a  >> b >> c >> d;
    if(abs(c-a)<=d){
        print("Yes");
        return;
    }
    if(abs(a-b)<=d&&abs(c-b)<=d){
        print("Yes");
        return;
    }
    print("No");
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

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

	a %= b;

	return gcd(b,a);
}

int lcm(int a,int b,int g){
	double a2,b2,g2;

	a2 = a*1.0;
	b2 = b*1.0;
	g2 = g*1.0;

	return (int)(a2/g2*b2);
}

int main(){
	int a,b,l,g;

	while(scanf("%d %d",&a,&b) != EOF){
		g = gcd(a,b);
		l = lcm(a,b,g);
		printf("%d %d\n",g,l);
	}

	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define M 1000000000+7
#define pie 3.141592653589793238
using namespace std;

signed main(){
    int n;cin>>n;
    int ans=0;
    int b[n-1];
    for(int i=0;i<n-1;i++){
    	cin>>b[i];
    	if(i == 0)
    		ans+=b[0];
    	if(i == n-2)
    		ans+=b[i];
    }
    for(int i=1;i<n-1;i++){
    	ans+=min((int)b[i],(int)b[i-1]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
vector<ll> v;
ll d[100001][13];
int k = 0;
ll go(int x, int y) {
	if (x == v.size()) {
		if (y == k)return 1;
		else return 0;
	}
	ll &ret = d[x][y];
	if (ret != -1)return ret;
	ret = 0;

	for (int i = 0; i < 10; i++) {
		ret += go(x + 1, (y + (i * v[x])) % 13);
		ret %= mod;
	}
	return ret %= mod;
}
int main() {
	// 코틀린 ,문자열 알고리즘 보기, 앳코더, (시간되면 코드포스까지)
	ios_base::sync_with_stdio(false); cin.tie(NULL); //9 90 900 
	// 5 18 31 
	ll ans = 0;
	string s; cin >> s;
	ll j = 1; 
	ll tmp = 0;
	memset(d, -1, sizeof(d));
	for (int i = s.size() - 1; i >= 0; i--) {
		if (s[i] == '?') {
			v.push_back(j);
		}
		else {
			tmp += (j * (s[i] - '0')) % 13;
			tmp %= 13;
		}
		j = (j * 10) % 13;
	}

	if (tmp <= 5) {
		k = 5 - tmp;
	}
	else {
		k = 13 - tmp + 5;
	}
	cout << go(0, 0) << '\n';

	
}

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

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()
const long long mod = 1000000000 + 7;
const long long INF = 9e18;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b){if (b == 0) return a;return gcd(b, a % b);}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }



int main(){
    int A, B, ans=0;
    cin >> A >> B;
    int i = 0;
    while(A + (i - 1) * (A - 1) < B){
        i++;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
const int mod = 1000 * 1000 * 1000 + 7;
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;
 
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


int main(){
   string s;
   cin>>s;
   if(s.find("A")!=-1 and s.find("B")!=-1){
      cout<<"Yes"<<endl;
   }
   else  cout<<"No"<<endl;
   return 0;
}

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

using namespace std;

const int MAX_N = 100, MIN_VAL = -100, MAX_VAL = 100;

int n, a[MAX_N + 1];
int ans;

int getAns(int x) {
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res += (a[i] - x) * (a[i] - x);
    }

    return res;
}

int main() {
    cin >> n;

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

    ans = MAX_N * (MAX_VAL - MIN_VAL) * (MAX_VAL - MIN_VAL);
    for (int i = MIN_VAL; i <= MAX_VAL; i++) {
        ans = min(ans, getAns(i));
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>
#include <cstring>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int x;
    cin >> x;
    if (x >= 30) cout << "Yes" << endl;
    else         cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define numarr 12
using namespace std;

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace AtCoder.ABC171
{
    public class Problem3
    {
        public static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(" ");

            var i = long.Parse(a[0]);

            Console.WriteLine(ToAlphabet(i).ToLower());
        }

        public static string ToAlphabet(long self)
        {
            if (self <= 0) return "";
            long n = self % 26;
            n = (n == 0) ? 26 : n;
            string s = ((char)(n + 64)).ToString();
            if (self == n) return s;
            return ToAlphabet((self - n) / 26) + s;
        }
    }
}


Measured memory_bytes: 27816
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
//#include <bits/stdc++.h>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007


#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(int a,int b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 

 
int main() {
    int N,M;
 // 最大 100 個ですが余裕をもたせます
    cin >> N>>M;
	    int a[M];
    for (int i = 0; i < M; ++i) cin >> a[i];

    sort(a, a + M,greater<int>()); 

	ll sabun[M-1];
	FOR(i,0,M-2){
		sabun[i]=a[i]-a[i+1];
	}

    sort(sabun, sabun +M-1,greater<int>()); 

	ll ans=0;
	if(N<M){
		FOR(i,N-1,M-2){
			ans=ans+sabun[i];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int H,W,K;
    cin>>H>>W>>K;
    vector<string> c(H);
    REP(i,H) cin>>c[i];
    int ans = 0;
    REP(bit, 1<<(H+W)){
        vector<string> s = c;
        REP(i,H+W){
            if(bit>>i&1){
                if(i<H) REP(j,W) s[i][j] = '.';
                else REP(j,H) s[j][i-H] = '.';
            }
        }
        int cnt = 0;
        REP(i,H) REP(j,W) if(s[i][j]=='#') cnt++;
        if(cnt==K) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
  
int main(){
  int a,b;
  string c;
  cin >> a >> b;
  if(a == b)
    c = "a == b";
  else if(a < b)
    c = "a < b";
  else
    c = "a > b";
  cout << c << endl;
}


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <tuple>

typedef long long ll;

using namespace std;
int main() {
    ll n, m;
    string s;
    ll a,b,c,d,e,k;
    cin >> a >> b>> c>> d >> e>> k;
    string ret = "Yay!";
    if(e-a>k) ret = ":(";
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 888
def main():
    S = [s for s in input()]
    As = 0
    BCs = 0
    N = len(S)
    i = 0
    ans = 0
    while i < N - 1:
        s0, s1 = S[i], S[i + 1]
        if s0 == 'A':
            As += 1
            i += 1
            continue
        if s0 != 'B' or s1 != 'C':
            As = 0
            i += 1
            continue
        BCs = 1
        i += 2
        while i < N - 1:
            s0, s1 = S[i], S[i + 1]
            if s0 != 'B' or s1 != 'C':
                break
            BCs += 1
            i += 2
        ans += As * BCs
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5096
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int b = sc.nextInt();
    int c = sc.nextInt();
    int a = sc.nextInt();
    
    System.out.println(a + " " + b + " " + c);
  }
}

Measured memory_bytes: 23764
local N = io.read("n")
local A1, A2 = {}, {}
for i=1,N do A1[i]=io.read("n") end
for i=1,N do A2[i]=io.read("n") end
local ans = 0
for sw=1,N do
  local c=0
  for i=1,sw do
    c=c+A1[i]
  end
  for i=sw,N do
    c=c+A2[i]
  end
  ans=math.max(ans,c)
end
print(ans)


Measured memory_bytes: 760
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int sum = 0;
    rep(i, N) {
        cin >> A[i];
        sum += A[i];
    }
    sort(All(A));
    reverse(All(A));
    int res = 0;
    rep(i, M) {
        if(A[i] * 4 * M >= sum)
            res++;
    }
    if(res == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

long sum_xor(long long n) {
    long long tmp = n % 4;
    switch (tmp) {
        case 0:
            return n;
        case 1:
            return 1;
        case 2:
            return n + 1;
        case 3:
            return 0;
    }
}

int main() {
    long long A, B;
    long long res = 0;
    cin >> A >> B;

    res = sum_xor(B) ^ sum_xor(A - 1);

    cout << res;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	if (A % 3 != 0 && B % 3 != 0 && (A + B) % 3 != 0) {
		cout << "Impossible" << endl;
	}
	else {
		cout << "Possible" << endl;
	}
}

Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
    }

    if s[2] == s [3] && s[4] == s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2096
#include <stdio.h>
#include <string.h>
int main() {
    char S[3];
    scanf("%s", S);
    if(strcmp(S, "SUN")==0){
        printf("%d", 7);
    }else if(strcmp(S, "MON")==0) {
        printf("%d", 6);
    }else if(strcmp(S, "TUE")==0) {
        printf("%d", 5);
    }else if(strcmp(S, "WED")==0) {
        printf("%d", 4);
    }else if(strcmp(S, "THU")==0) {
        printf("%d", 3);
    }else if(strcmp(S, "FRI")==0) {
        printf("%d", 2);
    }else if(strcmp(S, "SAT")==0) {
        printf("%d", 1);
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int n,h,a=0,r=1,i,s[200010]={};
  scanf("%d",&n);
  while(n--){
    scanf("%d",&h);
    while(s[r-1]>=h){
      r--;
      if(s[r]-h)a++;
    }
    s[r++]=h;
    //for(i=0;i<r;i++)printf("%d ",s[i]);printf(":%d\n",a);
  }
  printf("%d\n",a+r-1);
  return 0;
}

Measured memory_bytes: 1384
#include <cstdio>
using namespace std;
int arr[200010];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i ++){
        scanf("%d", &arr[i]);
    }
    int mins = arr[0];
    int ans = 1;
    for(int i = 1; i < n; i ++){
        if(arr[i] <= mins){
             mins = arr[i];
             ans ++;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdlib>
#include<cstdio>
#include<utility>
using namespace std;
int main(){
  int a,b,c,K,maxv=0,minv=0,tmp=0,sum=0;
  cin>>a>>b>>c>>K;
  tmp=a+b+c;
  maxv=max(a, b);
  maxv=max(maxv, c);
  minv=min(a, b);
  minv=min(minv, c);
  tmp = tmp-maxv-minv;
  for(int i=0;i<K;i++)maxv = 2*maxv;
  sum = maxv+minv+tmp;
  cout<<sum<<endl;
  return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


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

    if(s.size()%2!=0){
        cout<<"No"<<endl;
        return 0;
    }

    bool jdg=true;

    for (int i=0;i<s.size()-1;i+=2) {
        if(s[i]!='h'||s[i+1]!='i'){
            jdg=false;
            break;
        }
    }

    if(jdg)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

s = list(input())

al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")

ans = []

for i in s:
    ans.append(al[al.index(i)+n])
    
for i in ans:
    print(i,end = "")

Measured memory_bytes: 4596
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string str1, str2;
    cin >> str1 >> str2;

    int length = str1.length();

    bool ok = false;
    for (int i = 0; i < length + 1; i++) {
        if (str1 == str2) {
            ok = true;
            break;
        } else {
            char s = *--str1.end();
            for (int j = length - 2; j >= 0; j--) str1[j + 1] = str1[j];
            str1[0] = s;
        }
    }

    if (ok) cout << "Yes" << endl;
    else    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double num[1005];
void kitai(){
  	long double dp=0;
	for(int i=1;i<=1000;i++){
      dp+=i;
      num[i]=dp/i;
    }
}

signed main(){
	int n , k , d;
  	int  p[200005];
  	long long dpp=0;
  	long long ans=0;
  	cin>>n>>k;
  	kitai();
  	for(int i=0;i<n;i++){
      cin>>d;
      p[i] = num[d]*1000000;
      if(i<k){
        ans+=p[i];
       	dpp+=p[i];
      } else {
        dpp=dpp-p[i-k]+p[i];
		ans = max(ans , dpp);
      }
    }
  	cout<<ans/1000000<<'.'<<ans%1000000<<endl;
  	return(0);
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std ;

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b%m,(e-1)/2,m)%m;
	else
		return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	if(a>b)swap(a,b);
	while(b--)cout<<a;
	return 0;
}


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

using namespace std;

typedef long long ll;

#define p(x) cout << x << endl
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define range(i, begin, end) for(int i = begin; i < (int)(end + 1); i++)
#define all(x) (x).begin(), (x).end()

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

    vector<double> as(n);
    rep(i, n) { cin >> as[i]; }
    double sum = 0;
    rep(i, n) { sum += 1 / as[i]; }
    p(1 / sum);

    return 0;
}


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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  ll n, a, b;  cin >> n >> a >> b;
  vector<ll> x(n); cin >> x;
  ll ans = 0;
  for (int i = 1; i <= n-1; ++i){
    ans += min((x[i]-x[i-1])*a, 1LL*b);
  }
  cout << ans << "\n";
  return 0;
}	

Measured memory_bytes: 3968
# -*- coding: utf-8 -*-

alphabets = list('abcdefghijklmnopqrstuvwxyz')

N = int(input())

if N == 1:
    print('a')
else:
    tmp = ['a']
    for i in range(1, N):
        result = []
        for s in tmp:
            alpha_list = sorted(list(set(list(s))))
            for a in alpha_list:
                result.append(s+a)
            result.append(s+alphabets[len(set(list(s)))])
            tmp = result
    print('\n'.join(result))




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

using namespace std;

const int MAXN = 1e5 + 5;

pair <int, int> a[MAXN];

int b[MAXN];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		a[i].second = i;
	}		
	sort(a, a + n);
	int ans = 0;
	for (int i = 0; i < n; i++) 
		if ((a[i].second % 2) != (i % 2))
			ans++;
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 1024