akhauriyash/Code-Regression huggingface dataset:
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

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

  for(int i=0;i<3;i++){
    cin>>a[i];

  }

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

  if(a[0]==a[1]+a[2]){
    cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;

  }

  return 0;
  
  
  
  return 0;

}


Measured memory_bytes: 256
N, K = map(int, input().split())
k = 0

for n in range(1, N+1):
  if n >= K:
    break

  count = 0
  t = n
  while(t < K):
    t = t * 2
    count += 1
    
  k += (1 / N) * (1 - (1 / 2) ** count)

print(1 - k)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int num, i, ok = true;
	string s, a;
	map<string, int> d;
	cin >> num >> a;
	d[a] = 1;
	for (i = 1; i < num; i++) {
		cin >> s;
		if (a[a.size() - 1] != s[0] || d[s] == 1) {
			ok = false;
			break;
		}
		d[s] = 1;
		a = s;
	}
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include <random>
#include <chrono>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


int main() {
	int n;
	int old;
	cin >> n;
	vector<int> h(n);
	rep(i, n) {
		cin >> h[i];
	}
	reverse(h.begin(), h.end());
	old = h[0];
	rep(i, n) {
		if (old - h[i] == -1) {
			h[i]--;
		}
		else if (old - h[i] < 0) {
			cout << "No";
			return 0;
		}
		old = h[i];
	}

	cout << "Yes";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}
 
int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll a,b,c;cin>>a>>b>>c;
  if(a==b&&b==c){
    if(a%2)cout<<0<<endl;
    else cout<<-1<<endl;
  }
  else{
    for(res=0;;res++){
      if(a%2||b%2||c%2)break;
      else{
        ll bufa=a,bufb=b,bufc=c;
        a=(bufb+bufc)/2;
        b=(bufa+bufc)/2;
        c=(bufa+bufb)/2;
      }
    }
    cout<<res<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
a = list(input())
b = list(input())
c = list(input())

ls = [a,b,c]
new = 0

while True:
    if len(ls[new]) == 0:
        break
    if "a" == ls[new][0]:
        ls[new].pop(0)
        new = 0
    elif "b" == ls[new][0]:
        ls[new].pop(0)
        new = 1
    elif "c" == ls[new][0]:
        ls[new].pop(0)
        new = 2
        
if new == 0:
    print("A")
elif new == 1:
    print("B")
else:
    print("C")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;

  if (N%K == 0) cout << 0 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
S = input()
Ans = [0 for i in range(len(S))]
Child = 0
flag = True
a1 = 0
a2 = 0
for i in range(len(S)):
    if Child == 0:
        Child += 1
        continue
    if S[i] == S[i-1]:
        Child += 1
        continue
    if S[i] != S[i-1]:
        if flag:
            a1 = i-1
            a2 = i
            flag = False
            Ans[a1] += int((Child + 1) /2)
            Ans[a2] += int(Child/2)
            Child = 1
            continue
        else:
            Ans[a1] += int(Child / 2)
            Ans[a2] += int((Child + 1) / 2)
            a1 = -1
            a2 = -1
            flag = True
            Child = 1
            continue
Ans[a1] += int(Child / 2)
Ans[a2] += int((Child + 1) / 2)

for i in range(len(S)):
    print(Ans[i], end= " ")


Measured memory_bytes: 4872
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int cnt[200010];

struct Elem {
    int year, pref, id;
    Elem() {}
    Elem(int a, int b, int c) : year(a), pref(b), id(c) {}
    bool operator<(const Elem &e) const {
        return year < e.year;
    }
};

signed main() {
    int N, M; cin >> N >> M;

    vector<Elem> es;
    for(int i=0; i<M; i++) {
        int P, Y; cin >> P >> Y;
        es.push_back(Elem(Y, P, i));
    }
    sort(es.begin(), es.end());

    vector<string> ans(M);
    for(int i=0; i<M; i++) {
        int val = ++cnt[ es[i].pref ];

        string A = to_string(es[i].pref);
        string B = to_string(val);
        
        while(A.length() < 6) A = "0" + A;
        while(B.length() < 6) B = "0" + B;
        ans[ es[i].id ] = A + B;
    }

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

Measured memory_bytes: 10864
//package ABC173;

import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		int n=sc.nextInt();
		HashMap<String,Integer> hm=new HashMap<>();
		hm.put("AC",0);
		hm.put("WA",0);
		hm.put("TLE",0);
		hm.put("RE",0);
		for(int i=0;i<n;i++)
		{
			String s=sc.next();
			hm.put(s,hm.getOrDefault(s,0)+1);
		}
		System.out.println("AC x "+""+hm.get("AC"));
		System.out.println("WA x "+""+hm.get("WA"));
		System.out.println("TLE x "+""+hm.get("TLE"));
		System.out.println("RE x "+""+hm.get("RE"));

	}

}


Measured memory_bytes: 58256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{
    int a,b,c=0;
    cin>>a>>b;
    int x=b%2;
    int y=b/2;
    int z=b/4;
    if(b%4==2)
    z++;
    if(x==1)
    cout<<"No";
    else if(z<=a && y>=a)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

//INSERT ABOVE HERE
signed main(){
  Int q;
  cin>>q;
  while(q--){
    Int a,b;
    cin>>a>>b;
    if(a>b) swap(a,b);
    Int s=(a*b-1)/(b+1);

    Int L=0,R=b;
    while(L+1<R){
      Int M=(L+R)>>1;
      Int l=0,r=M+1;
      while(l+1<r){
	Int m=(l+r)>>1;
	if((m-1)*(a+M+1-(m-1))<=(m)*(a+M+1-m)) l=m;
	else r=m;
      }
      Int ok=1;
      for(Int k=max(l-10,(Int)1);k<=min(r+10,M);k++){
	ok&=k*(a+M+1-k)<a*b;
      }
      if(ok) L=M;
      else R=M;
    }
    Int v=L;
    //cout<<s<<" "<<v<<" "<<min(a-1-s,b-1-v)<<endl;
    cout<<s+v+min(a-1-s,b-1-v)<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
<?php
$W=trim(fgets(STDIN));
$Wl=strlen($W);
for($k=0;$k<$Wl;$k++){
  $n=ord($W[$k]);
  if($n<65) continue;
  if($n<91) $W[$k]=chr($n+32);
}

$C=0;
while(1){
  $T=trim(fgets(STDIN));
  if($T=='END_OF_TEXT') break;

  $Tl=strlen($T);
  for($k=0;$k<$Tl;$k++){
    $n=ord($T[$k]);
    if($n<65) continue;
    if($n<91) $T[$k]=chr($n+32);
  }
  $tl=$Tl-$Wl;

  for($i=0;$i<=$tl;$i++){
    if($T[$i]!=$W[0]) continue;
    $f=1;
    for($j=1;$j<$Wl;$j++){
      if($T[$i+$j]!=$W[$j]){$f=0;break;}
      ++$f;
    }
    if($i==0){
      if($i==$tl) ++$C;
      else if($T[$i+$f]==' ') ++$C;
    }
    else{
      if($T[$i-1]==' '){
        if($i==$tl) ++$C;
        else if($T[$i+$f]==' ') ++$C;
      }
    }
  }
}
echo $C;
?>

Measured memory_bytes: 15400
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll s,t,x,q,n;
    cin>>n>>q;
    vector<pair<ll,pair<ll,ll> > > v;
    for(int i=0;i<n;i++){
        cin>>s>>t>>x;
        v.pb(make_pair(s-x,make_pair(-1,x)));
        v.pb(make_pair(t-x-1,make_pair(1,x)));
    }
    for(int i=0;i<q;i++){
        cin>>s;
        v.pb(make_pair(s,make_pair(0,i)));
    }
    sort(be(v));
    vector<ll> ans;
    set<ll> se;
    for(int i=0;i<2*n+q;i++){
        t=v[i].second.first;
        x=v[i].second.second;
        if(t==-1)se.insert(x);
        if(t==1)se.erase(x);
        if(t==0) ans.pb(((se.empty())?-1:*(se.begin())));
    }
    for(int i=0;i<q;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}



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


Measured memory_bytes: 1920
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void) {

	long long int N;
	int count = 0;
	scanf("%lld", &N);
	int max = 0;

	for (int i = 2; i <= (int)sqrt((double)N); i++) {
		if (N%i == 0 && i > max&&max <N / i) {
			max = i;
		}
		else;
	
	}

	if (max >1) {
	printf("%lld", (long long int) max - 1 + (N / max) - 1);
	}
	else if(max==0){
		printf("%lld", N - 1);
	}


	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#define ft first
#define sd second
#define get(t, x) get<x>(t)
#define pb push_back
#define len length
#define dbgn(x) cerr << #x << ": " << x << '\n'
#define dbg(x) cerr << #x << ": " << x << ' '
#define MAX 1100000
 
using namespace std;
using namespace __gnu_pbds;
 
using lli = long long int;
using pll = pair<lli, lli>;
using pii = pair<int, int>;
using mii = map<int, int>;
using ti3 = tuple<int, int, int>;
using pqpi_min = priority_queue<pii, vector<pii>, greater<pii>>;
using ost = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T>
void print(T* a, int sz) {for(int i=0;i<sz;++i) cerr<<a[i]<<' ';cerr<<endl;}
istream &operator>>(istream &is, pii &p) {is >> p.ft >> p.sd;return is;}
ostream &operator<<(ostream &os, const pii &p) {os << "[" << p.ft << ", " << p.sd << ']'; return os;}
//int+string
//cin.ignore();
 
constexpr int M = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
 
void solve()
{
    string s;
    cin>>s;
    s[3]='8';
    cout<<s;
}   
int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        //全てに合格
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();

        long[] diff = a.Zip(b, (x, y) => x - y).ToArray();
        long[] amari = diff.Where(x => x > 0).OrderByDescending(x => x).ToArray();
        long badsum = -diff.Where(x => x < 0).Sum();

        int res = diff.Where(x => x < 0).Count();
        if (badsum <= 0)
        {
            Console.WriteLine(res);
            return;
        }
        foreach (var item in amari)
        {
            badsum -= item;
            res++;
            if(badsum <= 0)
            {
                Console.WriteLine(res);
                return;
            }
        }
        Console.WriteLine(-1);
    }
}


static class Writer
{
    public static void WriteLine<T>(this T item) => Console.WriteLine(item);

    public static void WriteLog<T>(this T item) => Debug.WriteLine(item);
}


Measured memory_bytes: 34400
/*
     A - αlphabet
    https://atcoder.jp/contests/abc171/tasks/abc171_ae
*/

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define ll long long // 10 ^ 18
#define forn(i, s, n) for (int i = s; i < n; i++)
#define whilen(val, n) while(n-- && cin >> val)
#define r_1(v) cin >> v
#define r_2(v1, v2) cin >> v1 >> v2

int main() {
    char a;
    r_1(a);
    if (a >= 'a' && a <= 'z') cout << 'a' << '\n';
    else cout << 'A' << '\n';
}

Measured memory_bytes: 3604
N, Q = list(map(int, input().split(" ")))
S = input()

num_list = []
tochu = [0 for _ in range(N)]
tochu2 = [0 for _ in range(N)]

state = 0
count = 0
for t_i, t in enumerate(S): 
    if "A" == t:
        state = 1
    elif "C" == t and state == 1:
        tochu[t_i-1] = 1
        tochu2[t_i] = 1
        state = 0
        count += 1
    else:
        state = 0
    num_list.append(count)

#print(num_list, tochu)
outs = []
for Q_i in range(Q):
    l, r = list(map(int, input().split(" ")))
    l -= 1
    r -= 1
    #out = max(0, num_list[r] - num_list[l] - tochu2[l])
    tmp = 0 if l -1 < 0 else num_list[l-1]
    out = num_list[r] - tmp - tochu2[l]
    outs.append(out)

for out in outs:
    print(out)

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

typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int n;
int main(){
    ll l,r;
    cin>>l>>r;
    ll smallest=2019;
    for(ll i=l;i<r;i++){
        for(ll j=i+1;j<=r;j++){
        if((!(i%2019))||(!(j%2019))){cout<<0<<endl; return 0;}
        else{
            ll temp=(i*j)%2019;
            if(smallest>temp){
                smallest=temp;
            }
        }
        }
    }
    cout<<smallest<<endl;
    return 0;
}




Measured memory_bytes: 256
A, B, K = map(int, input().split())
def calcgcd(a, b):
  if a > b:
    a, b = b, a
  while a > 0:
    a, b = b%a, a
  return b
d = calcgcd(A, B)
L = []
for i in range(1, d+1):
  if d%i == 0:
    L.append(i)
r = L[-K]
print(r)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fill(x,c) memset(x,c,sizeof(x))
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
int dp[200010];
int h[200010];
int t,n;
int MOD = 1e9+7;
const int SIZE = 1e6+10;
int main(){
	cin>>n;
	FOR(i,1,n)	cin>>h[i];
	fill(dp,0);
	dp[2] = abs(h[2]-h[1]); 
	FOR(i,3,n){
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<dp[n];
	return 0;
}




Measured memory_bytes: 1408
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1e9+7 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,k ;
	cin >> n >> k ;
	set<int> s ;
	for(int i=0;i<k;i++){
		int a ; cin >> a ;
		s.insert(a) ;
	}
	while(1){
		string num = to_string(n) ;
		bool ok = true ;
		for(int i=0;i<num.size();i++){
			ok &= (!s.count(num.at(i)-'0')) ;
		}
		if(ok){
			cout << n << endl ;
			return 0 ;
		}
		n++ ;
	}
}


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

ull ans[500][500];
int part[500][500];

void fail() {
  cout << -1 << endl;
  exit(0);
}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<ull> rtype(n), ctype(n), rval(n), cval(n);
  for (ull&v : rtype) cin >> v;
  for (ull&v : ctype) cin >> v;
  for (ull&v : rval) cin >> v;
  for (ull&v : cval) cin >> v;
  for (int bit = 0; bit < 64; bit++) {
    vector<int> rv(n), cv(n);
    for (int i = 0; i < n; i++) {
      rv[i] = rval[i]>>bit&1;
      cv[i] = cval[i]>>bit&1;
    }

    vector<int> rows, cols;
    fill_n((int*)part, 500*500, -1);
    for (int i = 0; i < n; i++) {
      if (rtype[i] != rv[i])
	for (int j = 0; j < n; j++)
	  part[i][j] = rv[i];
      else rows.push_back(i);
    }
    for (int j = 0; j < n; j++) {
      if (ctype[j] != cv[j])
	for (int i = 0; i < n; i++)
	  part[i][j] = cv[j];
      else cols.push_back(j);
    }

    if (rows.size() >= 2 && cols.size() >= 2) {
      int flipi = 0;
      for (int i : rows) {
	int flipj = 0;
	for (int j : cols) {
	  part[i][j] = flipi^flipj;
	  flipj ^= 1;
	}
	flipi ^= 1;
      }
    } else if (rows.size() == 1 && cols.size()) {
      int r = rows[0];
      for (int j : cols) {
	int found = 0;
	for (int i = 0; i < n; i++)
	  if (part[i][j] == cv[j])
	    found = 1;
	part[r][j] = (found ? rv[r] : cv[j]);
      }
    } else if (cols.size() == 1 && rows.size()) {
      int c = cols[0];
      for (int i : rows) {
	int found = 0;
	for (int j = 0; j < n; j++)
	  if (part[i][j] == rv[i])
	    found = 1;
	part[i][c] = (found ? cv[c] : rv[i]);
      }
    } else assert(cols.empty() || rows.empty());

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	if (part[i][j] == -1) fail();
	ans[i][j] |= ull(part[i][j])<<bit;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    ull v = ans[i][0];
    for (int j = 0; j < n; j++) {
      if (rtype[i] == 0)
	v &= ans[i][j];
      else
	v |= ans[i][j];
    }
    if (v != rval[i]) fail();
  }
  for (int j = 0; j < n; j++) {
    ull v = ans[0][j];
    for (int i = 0; i < n; i++) {
      if (ctype[j] == 0)
	v &= ans[i][j];
      else
	v |= ans[i][j];
    }
    if (v != cval[j]) fail();
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      cout << ans[i][j] << ' ';
    cout << endl;
  }
}


Measured memory_bytes: 8488
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1e9+7;

int main() {
  int N; cin >> N;
  vector<P> vec;
  vector<ll> a(N), b(N);
  for(int i = 0; i < N; ++i) {
    cin >> a[i];
    vec.emplace_back(P(a[i], i));
  }
  for(int i = 0; i < N; ++i) {
    cin >> b[i];
    vec.emplace_back(P(b[i], N+i));
  }
  sort(vec.begin(), vec.end());
  ll v = 1, cnt = 0;
  for(int i = 0; i < vec.size(); ++i) {
    if(vec[i].second < N) {
      if(cnt < 0) {
        v *= 1LL * (-cnt);
      }
      cnt++;
    }
    if(vec[i].second >= N) {
      if(cnt > 0) {
        v *= 1LL * cnt;
      }
      cnt--;
    }
    v %= mod;
  }
  std::cout << v << std::endl;
  return 0;
}


Measured memory_bytes: 8048
S = input()
T = input()

if T in S:
  print(0)
  exit()

ans = len(T)
for i in range(len(S)-len(T)+1):
  n = 0
  for s, t in zip(S[i:len(T)+i], T):
    n += (s!=t)
  ans = min(ans, n)
print(ans)

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 1");
            WillReturn.Add("00010");
            //4
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("14 2");
            WillReturn.Add("11101010110011");
            //8
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("1 1");
            WillReturn.Add("1");
            //1
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int K = wkArr[1];

        char[] SArr = InputList[1].ToCharArray();
        int UB = SArr.GetUpperBound(0);

        //ランレングス圧縮を行う
        //添字が偶数なら1のLength、奇数なら0のLengthを持つ、List
        var SeqList = new List<int>();
        int SeqCnt = 1;
        for (int I = 0; I <= UB; I++) {
            if (I == 0 && SArr[I] == '0') {
                SeqList.Add(0); //左端が0なら、番兵として、左端に1を追加する(lengthは0)
            }

            //連続した範囲の最後の場合
            if (I == UB || SArr[I] != SArr[I + 1]) {
                SeqList.Add(SeqCnt);
                SeqCnt = 1;
            }
            else {
                SeqCnt++;
            }

            if (I == UB && SArr[I] == '0') {
                SeqList.Add(0); //右端が0なら、番兵として、右端に1を追加する(lengthは0)
            }
        }

        //尺取法で解く
        int R = 0;
        int CurrSum = SeqList[0];
        int Answer = SeqList[0];
        UB = SeqList.Count - 1;

        //for (int I = 0; I <= UB; I++) Console.WriteLine("SeqList[{0}]={1}", I, SeqList[I]);

        for (int L = 0; L <= UB; L += 2) {
            while (R < UB && (R - L) / 2 < K) {
                CurrSum += SeqList[R + 1];
                CurrSum += SeqList[R + 2];
                R += 2;
            }

            //Console.WriteLine("始点{0},終点{1}での和={2}", L, R, CurrSum);

            Answer = Math.Max(Answer, CurrSum);
            if (L + 2 < UB) {
                CurrSum -= SeqList[L];
                CurrSum -= SeqList[L + 1];
            }
        }
        Console.WriteLine(Answer);
    }
}


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

/* #include<cstdio>*/
int main(){
	int n;
	for (int i = 1; true; i++){
		cin >> n;
		if (n == 0) break;
		cout << "Case " << i << ": " << n << endl;



	}
	return 0; 
}



Measured memory_bytes: 2984
N=int(input())
import math
if 0<=math.log10(N)<1:
  print(N)
elif 1<=math.log10(N)<2:
  print(9)
elif 2<=math.log10(N)<3:
  print(N-90)
elif 3<=math.log10(N)<4:
  print(909)
elif 4<=math.log10(N)<5:
  print(N-9090)
elif 5<=math.log10(N):
  print(90909)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include<map>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;

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

int gcd(int a, int b, int c) {
    return gcd(a, gcd(b, c));
}

int main() {
    int K;
    cin >> K;
    int sum = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                sum += gcd(i, j, k);
            }
        }
    }
    cout << sum << endl;
}



Measured memory_bytes: 3604
#include <stdio.h>
int main(void)
{
    int T,N,i,t[200000],sum=0;
    scanf("%d %d", &N, &T);
    for(i=0;i<N;i++) scanf("%d",&t[i]);
    if(N==1);
    else for(i=1;i<N;i++) sum += T<t[i]-t[i-1] ? T:t[i]-t[i-1];
    printf("%d\n",sum+T);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using P = pair<int,int>;
using ll = long long;



int main() {
    ll a,b,c;
    int n;
    string dec[100005];
    cin >> n >> a >> b >> c;
    vector<string> moji;
    string s;
    bool pos = true;

    rep(i,n) {
        cin >> s;
        moji.push_back(s);
    }

    rep(i,n){
        if(moji[i]=="AB"){
            if(a==0 && b==0){
                pos=false;
            }else if(a==b && i<n-1){
                    if(moji[i+1]=="BC"){
                        a--;
                        b++;
                        dec[i]="B";
                    }else{
                        a++;
                        b--;
                        dec[i]="A";
                    }
            }else if(a>b){
                a--;
                b++;
                dec[i]="B";
            }else{
                a++;
                b--;
                dec[i]="A";
            }
        }
        if(moji[i]=="BC"){
            if(b==0 && c==0){
                pos=false;
            }else if(b == c && i<n-1){
                    if(moji[i+1]=="AB"){
                        b++;
                        c--;
                        dec[i]="B";
                    }else{
                        b--;
                        c++;
                        dec[i]="C";
                    }
            }else if(b>c){
                b--;
                c++;
                dec[i]="C";
            }else{
                b++;
                c--;
                dec[i]="B";
            }
        }
        if(moji[i]=="AC"){
            if(a==0 && c==0){
                pos=false;
            }else if(a==c && i<n-1){
                    if(moji[i+1]=="AB"){
                        a++;
                        c--;
                        dec[i]="A";
                    }else{
                        a--;
                        c++;
                        dec[i]="C";
                    }
            }else if(a>c){
                a--;
                c++;
                dec[i]="C";
            }else{
                a++;
                c--;
                dec[i]="A";
            }
        }
    }

    if(pos){
        cout << "Yes" << endl;
        rep(i,n) cout << dec[i] << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 10596
import math

a, b, h, m = map(int, input().split())

hh = (h * 60 + m) * 0.5
mm = m * 6
do = max(hh, mm) - min(hh, mm)
do = min(do, 360 - do)
sin = math.sin(math.radians(do))
if do == 90:
    print(math.sqrt(a ** 2 + b ** 2))

elif do > 90:
    hi = b * sin
    a_sub = math.sqrt(b ** 2 - hi ** 2)
    hy = math.sqrt((a + a_sub) ** 2 + hi ** 2)
    print(hy)

elif do < 90:
    hi = b * sin
    a_sub = math.sqrt(b ** 2 - hi ** 2)
    hy = math.sqrt((a_sub - a) ** 2 + hi ** 2)
    print(hy)

Measured memory_bytes: 9480
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

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

int main()
{

  int n, m, c;
  cin >> n >> m >> c;
  int b[m + 10];
  rep(i, m) cin >> b[i];
  int a[n + 10][m + 10];
  int ans = 0;
  rep(i, n)
  {
    ll sum = 0;
    rep(j, m) {
      cin >> a[i][j];
      sum += a[i][j] * b[j];
    }
    if(sum+c>0)ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int ma = 100000;
vector<int> v(ma+1);
vector<int> prime;

void erast(){
    for(int i=0;i<=ma;i++){
        v[i] = 1;
    }
    for(int i=2;i*i<=ma;i++){
        if(v[i]){
            for(int j=0;i*(j+2)<=ma;j++){
                v[i*(j+2)]=0;
            }
        }
    }
    v[1] = false;
    for(int i=2;i<=ma;i++){
        if(v[i]){
            prime.push_back(i);
        }
    }
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    erast();
    vec<int> S(ma+1);
    for(int i=1;i<=ma;i++){
        int c = i%2==1 && v[i] && (v[(i+1)/2]);
        S[i+1] = S[i]+c;
    }
    int Q;
    cin >> Q;
    while(Q--){
        int l,r;
        cin >> l >> r;
        cout << S[r+1]-S[l] << "\n";
    }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int n, W;
long long weight[110], value[110];

long long dp[110][100010];

int main() {
  cin >> n >> W;
  for (int i = 0; i < n; ++i) cin >> weight[i]  >> value[i];

  for (int w = 0; w <= W; w++) dp[0][w] = 0;

  for (int i = 0; i < n; i++) {
  for (int w = 0; w <= W; w++) {
    if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
    else dp[i+1][w] = dp[i][w];

  }
  }

cout << dp[n][W] << endl;
}

Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long int i,m,j,l,n,a=0,b,x=10000000000;
    vector<long long int>ar;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>j;
        ar.push_back(j);
    }
  long long  int sum=0;
    for(l=0;l<n;l++){
        sum+=ar[l];
    }
    for(m=0;m<n-1;m++){
       a+=ar[m];b=sum-a;
        x=min(x,abs(a-b));
    }
       
    cout<<x<<endl;
    }

Measured memory_bytes: 2420
#include <iostream>

using namespace std;
int n,k,G,x,mx,i;
int gcd(int A,int B)
{
    if((!A)||(!B)) return A+B;
    return gcd(B,A%B);
}
int main()
{
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        mx=max(mx,x);
        G=gcd(G,x);
    }
    if(k%G==0&&k<=mx) cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
d={}
for i in range(n):
    if a[i] in d:
        d[a[i]]+=1
    else:
        d[a[i]]=1
ans=0
for i in range(n+1):
    if i in d:
        k=d[i]
    else:
        continue
    ans+=k*(k-1)//2
for i in range(n):
    k=d[a[i]]
    ans1=ans
    ans1-=k*(k-1)//2
    ans1+=(k-1)*(k-2)//2
    print(ans1)


Measured memory_bytes: 86732
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

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

struct UnionFind{
    vector<int> par;
    vector<int> rank;
    UnionFind(int n){
        par = vector<int>(n, -1);
        rank = vector<int>(n, 0);
    }

    int root(int x){
        if(par[x] < 0){
            return x;
        }
        return par[x] = root(par[x]);
    }

    bool isSame(int a, int b){
        return root(a) == root(b);
    }

    bool merge(int a, int b){
        a = root(a);
        b = root(b);
        if(isSame(a, b)){
            return false;
        }
        if(rank[a] < rank[b]){
            swap(a, b);
        }
        if(rank[a] == rank[b]){
            rank[a] ++;
        }
        par[a] += par[b];
        par[b] = a;
        return true;
    }

};

int main(){
    int N, K, L;
    cin >> N >> K >> L;
    vector<pair<int, int>> cs;
    UnionFind pq(N);
    UnionFind rs(N);
    rep(i, K){
        int p, q;
        cin >> p >> q;
        p --;
        q --;
        pq.merge(p, q);
    }
    rep(i, L){
        int r, s;
        cin >> r >> s;
        r --;
        s --;
        rs.merge(r, s);
    }
    rep(i, N){
        pair<int, int> c = {pq.root(i), rs.root(i)};
        cs.push_back(c);
    }
    sort(cs.begin(), cs.end());
    rep(i, N){
        pair<int, int> c = {pq.root(i), rs.root(i)};
        int cnt = upper_bound(cs.begin(), cs.end(), c) - lower_bound(cs.begin(), cs.end(), c);
        cout << cnt << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int a, b, c, d; // a 高橋くんの体力 b 高橋くんの攻撃力 c 青木くんの体力 d 青木くんの攻撃力
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0)
    {
        c -= b;
        if (c <= 0)
            break;
        a -= d; 
    }
    if (a <= 0)
        cout << "No" << "\n";
    else
        cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 3564
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 100010
#define ll long long
#define inf 0x3f3f3f3f 
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
inline void read( int &x ){
    x = 0 ; int f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}
inline void readl( ll &x ){
    x = 0 ; ll f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}
using namespace std ;
int n , m , a[ N ] ,b[N ];
int x ,y ;

int main(){
	int mn = inf , mx = 0 ;
	scanf( "%d%d" , &n , &m ) ;
	in2(x,y);
	for( int i = 1 ; i <= n ; i ++ ) {in1( a[ i ] ) ;
	}
	for( int i = 1 ; i <= m ; i ++ ) {in1( b[ i ] ) ;
	}
	a[ 0 ] = x ; b [ 0 ]  = y ;
	sort( a , a+ n + 1);
	sort( b , b + m + 1 ) ;
	if( a[ n ] < b[ 0 ] )puts("No War");
	else puts("War");
}


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

inline void swap(int& a, int&b)
{
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
}

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

    int lots[w];
    for(int i=0; i<w; i++) lots[i] = i+1;
    
    cin >> n;
    for(int i=0; i<n; i++){
        int a, b;
        scanf("%d,%d", &a, &b);
        swap(lots[a-1], lots[b-1]);
    }

    for(int i=0; i<w; i++) cout << lots[i] << endl;

    return 0;
}

Measured memory_bytes: 1240
import bisect


A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
S = [-10 ** 12] + S + [10 ** 12]
T = [-10 ** 12] + T + [10 ** 12]
for x in X:
    si = bisect.bisect_right(S, x)
    ti = bisect.bisect_right(T, x)
    Ls, Rs = x - S[si - 1], -x + S[si]
    Lt, Rt = x - T[ti - 1], -x + T[ti]
    ans = min(Ls * 2 + Rt, Ls + Rt * 2, Lt * 2 + Rs,
              Lt + Rs * 2, max(Ls, Lt), max(Rs, Rt))
    print(ans)


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

int main(){
  string str;
  while(getline(cin, str)){
    if(str.length() == 1 && str[0] == '.')break;

    stack<char> st;
    bool ok = true;
    for(int i = 0; i < str.length(); i++){
      if(st.empty()){
        if(str[i] == ']' || str[i] == ')'){
          ok = false;
          break;
        }
      }

      if(str[i] == '[' || str[i] == '('){
        st.push(str[i]);
      }else if(str[i] == ')' || str[i] == ']'){
        if((st.top() == '(' && str[i] == ')') || (st.top() == '[' && str[i] == ']')){
          st.pop();
        }else{
          ok = false;
          break;
        }
      }
    }
    cout << (st.empty() && ok ? "yes" : "no") << endl;
  }
}

Measured memory_bytes: 3108
import java.util.*;


import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();		
		int k = ni();
		int q = ni();
		int[] a = na(q);
		
		int[]p = new int[n];

		for(int ai:a) {
			p[ai - 1]++;
		}
		for(int pi:p) {
			if(pi + k - q > 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}		
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		} 
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 41112
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int a, b;
	cin >> a >> b;
	printf((a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ? "Possible\n" : "Impossible\n");
}

Measured memory_bytes: 256
fun main() {
    val (N, Y) = readLine()!!.split(" ").map { it.toInt() }

    for (i in (0..N)) {
        for (j in (0..N)) {
            val k = N - i - j
            if (k < 0) {
                continue
            }

            if (10000 * i + 5000 * j + 1000 * k == Y) {
                println("$i $j $k")
                return
            }
        }
    }
    println("-1 -1 -1")
}

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

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for (int v = 1; v <= 50000; v++) {
		int u = int(v * 1.08);
		if (u == n) {
			cout << v << '\n';
			exit(0);
		}
	}
	cout << ":(" << '\n';
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn gen_seq(n: usize, m: usize, v: Vec<usize>, r: &mut Vec<Vec<usize>>) {
   if v.len() == n {
      r.push(v);
      return;
   }
   for i in *v.last().unwrap_or(&1)..=m {
      let mut v_clone = v.clone();
      v_clone.push(i);
      gen_seq(n, m, v_clone, r);
   }
}

fn main() {
   input! {
      n:usize,m:usize,q:usize,
      v:[(Usize1,Usize1,usize,usize);q]
   }
   let mut r = vec![];
   gen_seq(n, m, vec![], &mut r);
   let mut ans = 0_usize;
   for s in r {
      let mut buf = 0;
      for &(f, t, c, d) in &v {
         if s[t] - s[f] == c {
            buf += d;
         }
      }
      ans = std::cmp::max(ans, buf);
   }
   println!("{}", ans);
}

Measured memory_bytes: 18636
#include <stdio.h>
 
int main(void)
{
 int a,b,c;
 scanf("%d %d %d",&a,&b,&c);
 
 if (a < b && b < c) {
                    printf ("Yes\n");
 }
  else {
        printf("No\n");
 }
 return 0;
}

Measured memory_bytes: 1816
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b);
#define chmin(a,b) a = min(a,b);

struct Edge {
	ll from, to;
	ll w;
};


int memo[1 << 18 + 1][2] = {};
int n;
vector<int> a;

void func(int k) {
	if (memo[k][0] != n) return;
	memo[k][0] = k;
	REP(i, 20) {
		if (bitcheck(k, i)) {
			int nex = k & (~(1 << i));
			func(nex);
			pii buf[4] = { {a[memo[k][0]],memo[k][0]},{a[memo[k][1]],memo[k][1]},{a[memo[nex][0]],memo[nex][0]},{a[memo[nex][1]],memo[nex][1]} };
			sort(buf, buf + 4, greater<pii>());
			unique(buf, buf + 4);
			memo[k][0] = buf[0].second;
			memo[k][1] = buf[1].second;
		}
	}
}

signed main(void) {
	cin >> n;
	n = pow(2, n);
	Fill(memo, n);
	a.resize(n);
	REP(i, n)
		cin >> a[i];

	a.push_back(0);

	int Max = 0;

	rep(i, 1, n) {
		func(i);
		chmax(Max, a[memo[i][1]] + a[memo[i][0]]);
		printf("%d\n", Max);
	}



	return 0;
}

Measured memory_bytes: 8188
class Union_Find():
    def __init__(self, N):
        self.N = N
        self.par = [i for i in range(N)]
        self.height = [0 for i in range(N)]
    def Find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.Find(self.par[x])
        return self.par[x]
    def Union(self, x, y):
        x, y = self.Find(x), self.Find(y)
        if self.height[x] < self.height[y]:
            self.par[x] = y
        else:
            self.par[y] = self.par[x]
            if self.height[x] == self.height[x]:
                self.height[x] += 1
    def Same(self, x, y):
        return Find(x) == Find(y)

N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]
ans = 0
for i in range(M):
    uf = Union_Find(N)
    for j in range(M):
        if i == j:
            continue
        uf.Union(edges[j][0] - 1, edges[j][1] - 1)
    cnt = 0
    for i in range(N):
        if uf.par[i] == i:
            cnt += 1
    if cnt > 1:
        ans += 1
print(ans)

Measured memory_bytes: 3064
/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
#define maxi 100005

int main()
{
    fastread;
    int n,m;
    cin>>n>>m;
    int tot[n],ans[n];
    memset(tot,0,sizeof(tot));
    memset(ans,0,sizeof(ans));
    bool ac[n];
    memset(ac,0,sizeof(ac));
    for(int i=0;i<m;i++){
    	int pid;
    	string verd;
    	cin>>pid>>verd;
    	pid--;
    	if(verd == "AC" && !ac[pid]){
    		ans[pid] = tot[pid];
    		ac[pid] = true;
    	}
    	tot[pid]++;
    }
    int nac,pen;
    nac = pen = 0;
    for(int i=0;i<n;i++)
    	if(ac[i]){
    		pen += ans[i];
    		nac++;
    	}
    cout<<nac<<" "<<pen<<endl;
    return 0;
}

Measured memory_bytes: 1280
N,Q = map(int,input().split())
S = input()
c = []
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        count += 1
    c.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    if l == 1:
        print(c[r-2]-0)
    else:
        print(c[r-2]-c[l-2])

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


Measured memory_bytes: 2720
/*氏名：保坂優介, 学籍番号：200441141
  概要：数列を反転する*/

#include<stdio.h>

int main(void)
{
    int i, j, n, a[1000] = { 0 };       //変数の宣言

    scanf("%d", &n);        //入力

    for (i = 0; i < n; i++)     //n回読み込み
    {
        scanf("%d", &a[i]);
    }

    for (i = n - 1; i > 0; i--)
    {
        printf("%d ", a[i]);        //表示
    }

    printf("%d\n", a[0]);        //表示

    return 0;
}


Measured memory_bytes: 2092