akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  vi L(N); rep(i,N) cin >> L.at(i);
  
  sort(all(L));
  reverse(all(L));
  
  int sum = 0;
  repf(i,1,N) sum += L.at(i);
  
  cout << (L.at(0)<sum ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,x;
  cin >> n;
  x=n%10;
    if(x==2 || x==4 || x==5 || x==7 || x==9)
    {
      cout << "hon";
    }
    if(x==0 || x==1 || x==6 || x==8)
    {
      cout << "pon";
    }
    if(x==3)
    {
      cout << "bon";
    }


  return 0;
}


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

int main (){
  string S;
  cin >> S;
  
  if ((S.at(2) == S.at(3)) && (S.at(4) == S.at(5))){
  cout << "Yes" << endl;
     }
  
  else {cout << "No" << endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  list<int> L;
  for (int i = 0; i < n; i++){
    string q;
    cin >> q;
    if (q == "insert"){
      int x;
      cin >> x;
      L.push_front(x);
    }
    if (q == "delete"){
      int x;
      cin >> x;
      for (list<int>::iterator itr = L.begin(); itr != L.end(); itr++){
        if (*itr == x){
          L.erase(itr);
          break;
        }
      }
    }
    if (q == "deleteFirst"){
      L.pop_front();
    }
    if (q == "deleteLast"){
      L.pop_back();
    }
  }
  while (!L.empty()){
    cout << L.front();
    L.pop_front();
    if (!L.empty()){
      cout << ' ';
    }
  }
  cout << endl;
}


Measured memory_bytes: 34436
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  int X,Y; cin >> X >> Y;
  if(X % Y == 0){
    cout << "-1" << endl;
    return 0;
  }
  else{
    int x = 2;
    while(1){
      if(X*x%Y!=0){
        cout << X*x << endl;
        return 0;
      }
      x++;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HGrid1 solver = new HGrid1();
        solver.solve(1, in, out);
        out.close();
    }

    static class HGrid1 {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            char[][] grid = new char[n][m];
            for (int i = 0; i < n; i++) {
                grid[i] = sc.nextLine().toCharArray();
            }


            long[][] dp = new long[n][m];
            dp[n - 1][m - 1] = 0;
            for (int i = n - 2; i >= 0; i--) {
                if (grid[i][m - 1] != '#')
                    dp[i][m - 1] = 1;
                else
                    break;
            }

            for (int i = m - 2; i >= 0; i--) {
                if (grid[n - 1][i] != '#')
                    dp[n - 1][i] = 1;
                else {
                    break;
                }
            }

            for (int i = n - 2; i >= 0; i--) {
                for (int j = m - 2; j >= 0; j--) {
                    if (grid[i][j] != '#') {
                        dp[i][j] = dp[i + 1][j] + dp[i][j + 1];
                        dp[i][j] %= 1000000007;
                    }
                }
            }
            out.println(dp[0][0]);

        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}



Measured memory_bytes: 39048
#include <cstdio>
#include <cctype>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
const int p=924844033;
int n,inv[200100],s[200100],f[530000],g[530000];
struct edge
{
    int v;
    edge *nxt;
} pool[400100],*tp=pool,*fst[200100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}
 
int power(int x,int k)
{
    int ret=1;
    for (; k; k>>=1,x=LL(x)*x%p)
        if (k&1)
            ret=LL(ret)*x%p;
    return ret;
}

void ntt(int *a,int n,int flag)
{
    static int rev[530000];
    repu(i,0,n-1)
        if (i<(rev[i]=(rev[i>>1]>>1)|(i&1)*(n>>1)))
            swap(a[i],a[rev[i]]);
    for (int i=1; i<n; i<<=1)
    {
        int wn=power(5,(p-1)/i/2);
        if (flag==-1)
            wn=power(wn,p-2);
        for (int j=0; j<n; j+=i*2)
        {
            int w=1,t;
            repu(k,0,i-1)
            {
                t=LL(w)*a[j+k+i]%p,w=LL(w)*wn%p;
                a[j+k+i]=(a[j+k]+p-t)%p,(a[j+k]+=t)%=p;
            }
        }
    }
    if (flag==1)
        return;
    int inv=power(n,p-2);
    repu(i,0,n-1)
        a[i]=LL(a[i])*inv%p;
}

void dfs(int x,int fa)
{
    s[x]=1;
    for (edge *i=fst[x]; i; i=i->nxt)
        if (i->v!=fa)
            dfs(i->v,x),s[x]+=s[i->v],(f[s[i->v]]+=p-1)%=p;
    ++f[n],(f[n-s[x]]+=p-1)%=p;
}

int main()
{
    n=getint();
    repu(i,1,n-1)
    {
        int u=getint(),v=getint();
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    dfs(1,0);
    inv[0]=inv[1]=1;
    repu(i,2,n)
        inv[i]=LL(p-p/i)*inv[p%i]%p;
    int t=1;
    repu(i,0,n)
    {
        g[n-i]=inv[i],inv[i+1]=LL(inv[i+1])*inv[i]%p;
        f[i]=LL(f[i])*t%p,t=LL(i+1)*t%p;
    }
    int k=1;
    for (; k<=n*2; k<<=1);
    ntt(f,k,1),ntt(g,k,1);
    repu(i,0,k-1)
        f[i]=LL(f[i])*g[i]%p;
    ntt(f,k,-1);
    repu(i,1,n)
        printf("%d\n",LL(f[i+n])*inv[i]%p);
    return 0;
}

Measured memory_bytes: 25600
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int M=sc.nextInt();
		System.out.println(24+(24-M));
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


Measured memory_bytes: 23124
def getyakusu(V):
    if V%2==0:
        return 0
    c=0
    for i in range(1,V+1):
        if V % i ==0:
            c+=1
    return 1 if c==8 else 0


def resolve():
    N=int(input())
    print(sum(map(getyakusu,range(1,N+1))))


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 38384
#include<stdio.h>

int main(void){
    int A, B, T;
    int cookie = 0;
    scanf("%d%d%d", &A, &B, &T);
    for(int t=1;t<T+1;t++){
        if(t%A == 0) cookie += B;
    }
    printf("%d", cookie);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int h, w; std::cin >> h >> w;
    std::vector<std::vector<char>>grid(h,std::vector<char>(w));
    for(int i=0;i<h;i++)for(int j=0;j<w;j++){
        std::cin>>grid.at(i).at(j);
    }
    int h0=0;
    for(int i=0;i<h;i++){
        bool found=false;
        for(int j=0;j<w;j++){
            grid.at(h0).at(j)=grid.at(i).at(j);
            if(grid.at(h0).at(j)=='#')found=true;
        }
        if(found)h0++;
    }
    int w0=0;
    for(int j=0;j<w;j++){
        bool found=false;
        for(int i=0;i<h;i++){
            grid.at(i).at(w0)=grid.at(i).at(j);
            if(grid.at(i).at(w0)=='#')found=true;
        }
        if(found)w0++;
    }
    for(int i=0;i<h0;i++){
        for(int j=0;j<w0;j++){
            std::cout<<grid.at(i).at(j);
        }
        std::cout<<std::endl;
    }
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<PLL> xy(n);

  rep(i,n){
    cin >> xy[i].first >> xy[i].second;
  }

  sort(all(xy));
  reverse(all(xy));
  ll sum = n;
  map<PLL,int> cnt;
  rep(i,n){
    rep(j,n){
      if(i == j) continue;
      cnt[make_pair( xy[i].first - xy[j].first , xy[i].second - xy[j].second )]++;
    }
  }
  int ans = 0;
  for(auto x : cnt){
    ans = max(x.second,ans);
  }


  //cout << ans << endl;
  cout << sum - ans << endl;
  return 0;
}


Measured memory_bytes: 384
n,m=map(int,input().split())
sub=[tuple(input().split()) for j in range(m)]
ac=[False for i in range(n)]
wa=[0 for i in range(n)]
for p,s in sub:
    p=int(p)
    if s=='AC':
        ac[p-1]=True
    else:
        if ac[p-1]==False:
            wa[p-1]+=1
# print(ac)
# print(wa)
ans=0
pena=0
for AC,WA in zip(ac,wa):
    if AC:
        ans+=1
        pena+=WA
print(ans,pena)

Measured memory_bytes: 22896
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int mod(ll a){
    int c=a%1000000007;
    if(c>=0)return c;
    else return c+1000000007;
}
typedef pair<int,int> i_i;

#define inf 1<<21
/*
int map[5][5];
int p[5];
int d[5];
bool color[5];

*/
int main(){
    int n;cin>>n;
    int map[n][n];int p[n];int d[n];bool color[n];
    for(int i=0;i<=n-1;i++)for(int j=0;j<=n-1;j++){
        int k;cin>>k;
        map[i][j]=k==-1?inf:k;
    }
    for(int i=0;i<=n-1;i++)p[i]=-1;
    for(int i=0;i<=n-1;i++)d[i]=inf;
    for(int i=0;i<=n-1;i++)color[i]=false;
    
    /*color[0]=true;*/
    d[0]=0;
    
    while(1){
        int mincost=inf;
        int u=-1;
        for(int i=0;i<=n-1;i++){
            if(color[i]==false&&mincost>d[i]){
                mincost=d[i];
                u=i;
            }
        }
        if(u==-1)break;
        
        color[u]=true;
        for(int i=0;i<=n-1;i++){
            if(color[i]==false&&d[i]>map[u][i]){
                d[i]=map[u][i];
                p[i]=u;
            }
        }
        
    }
    ll sum=0;
    for(int i=1;i<=n-1;i++){
        sum+=map[i][p[i]];
    }
    cout<<sum<<endl;
    return 0;
}
















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

#define int long long int

vector<int> a;
int n;

decltype(0) main() {
    cin >> n;
    a = vector<int>(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    int ans = 1000;
    for (int i = 1; i < n; ++i) {
        if (a[i-1] < a[i]) {
            const auto pre = ans;
            ans %= a[i-1];
            ans += pre / a[i-1] * a[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3548
# https://beta.atcoder.jp/contests/agc029/submissions/3804087
from collections import Counter

N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = Counter(a)

ans = 0
for t in a:
    s = (1 << t.bit_length()) - t
    if t == s:
        ans += b[t] // 2
        b[t] %= 2
    else:
        u = min(b[s], b[t])
        ans += u
        b[s] -= u
        b[t] -= u

print(ans)


Measured memory_bytes: 56380
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

int main() {
  long long n, x;
  cin >> n >> x;
  cout << 3 * (n - gcd(n, x)) << endl;
  return 0;
}


Measured memory_bytes: 256
def read():
    N = int(input())
    renga = [int(i) for i in input().split()]

    return N, renga


def solve(N, renga):
    ans = -1
    # print(renga)
    count = 0
    for i in range(N):
        if renga[i]==count+1:
            count+=1


    if count==0:
        print(-1)
    else:
        print(N - count)


if __name__ == '__main__':
    N, renga = read()
    # print("%d" % solve(N, renga))
    solve(N, renga)


Measured memory_bytes: 25716
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(0<a&&0<b)puts("Positive");
    else if(a<0&&b<0&&(b-a)%2==1)puts("Positive");
    else if(a<0&&b<0&&(b-a)%2==0)puts("Negative");
    else puts("Zero");
    return 0;
}


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

using namespace std;

const int mod = 998244353;

int N, K, ans;
vector<int> fac, ifac;

int pow_mod(int x, int n) {
	int y = 1;
	while(n) {
		if(n & 1) {
			y = (long long) y * x % mod;
		}
		x = (long long) x * x % mod;
		n >>= 1;
	}
	return y;
}

int inv(int x) {
	return pow_mod(x, mod - 2);
}

int C(int n, int m) {
	return m < 0 || n < m ? 0 : (long long) fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

void prepare() {
	fac.resize(K + 1);
	ifac.resize(K + 1);
	fac[0] = 1;
	for (int i = 1; i <= K; ++i) {
		fac[i] = (long long) fac[i - 1] * i % mod;
	}
	ifac[K] = inv(fac[K]);
	for (int i = K; i; --i) {
		ifac[i - 1] = (long long) ifac[i] * i % mod;
	}
	return;
}

int calc(int T, int R, int B) {
	return T > 0 ? (C(R + B, R) - C(R + B, B - T)) % mod : 0;
}

int main() {
	cin >> N >> K;
	prepare();
	for (int R = K; R * 2 >= K; --R) {
		int B = K - R, T = R - N + 1;
		if(R == B) {
			--B;
		}
		ans = (ans + calc(T, R, B)) % mod;
	}
	cout << (ans + mod) % mod << endl;
	return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define each(it,c) for(__typeof(c.begin()) it=c.begin(); it!=c.end(); it++)
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;
typedef map<int,int> mpii;
typedef priority_queue<int, vi, greater<int> > pqi;
typedef long long ll;

int main(){
	int n,l; cin>>n>>l;
	vector<string> s;
	rep(i,n){
		string st; cin>>st;
		s.pb(st);
	}
    sort(all(s));
	rep(i,n) cout<<s[i];
	cout<<endl;
	return 0;
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';
ll const mod = 1e9+7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0;i < n;++i) cin >> a[i];
    ll sum = 0,ans = 0;
    for (int i = 0;i < n;++i) {
        (ans += sum*a[i]%mod) %= mod;
        (sum += a[i]) %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4048
fun main(args: Array<String>) {
    val (n, w) = readLine()!!.split(" ").map { it.toInt() }
    val wv = Array(n) { Array(2) { 0 } }
    for (i in 0 until n) {
        val tmp = readLine()!!.split(" ").map { it.toInt() }.toTypedArray()
        wv[i] = tmp
    }

    val dp = Array(n + 1) { LongArray(w + 1) { 0L } }

    for (i in 0 until n) {
        for (j in 0 until w + 1) {
            if (j < wv[i][0]){
                dp[i+1][j] = dp[i][j]
            }else{
                dp[i+1][j] = Math.max(dp[i][j - wv[i][0]] + wv[i][1], dp[i][j])
            }
        }
    }

    println(dp[n][w])
}

Measured memory_bytes: 155708
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_074_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 N      PIC 9(5).
    01 A      PIC 9(5).
    01 ans    PIC X(5).

    01 ZS     PIC Z(6)9.
    01 DUMMY  PIC X(1).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.
    ACCEPT A.

    COMPUTE N = N ** 2.
    SUBTRACT A FROM N.

    MOVE N TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

int zalgorithm(string s) {
  VI v(s.size(), 0);
  v[0] = s.size();
  int i = 1;
  int j = 0;
  int m = 0;
  while(i < s.size()) {
    while(i + j < s.size() && s[j] == s[i + j]) j++;
    v[i] = j;
    if(j == 0) {
      i++;
      continue;
    }
    int k = 1;
    while(i + k < s.size() && v[k] + k < j) {
      v[i + k] = v[k];
      k++;
    }
    i += k;
    j -= k;
  }
  for(int i = 0; i < v.size(); ++i) {
    if(v[i] - 1 < i) m = std::max(m, v[i]);
  }
  return m;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m = 0;
  rep(i, n) m = std::max(m, zalgorithm(s.substr(i)));
  out(m);
  return 0;
}


Measured memory_bytes: 384
s=input()
def r(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append(l)
            l=1
    ll.append(l)
    return ll
b=r(s)
for i in range(len(b)//2):
    for j in range(b[2*i]-1):
        print(0,end=' ')
    print((b[2*i]-1)//2+b[2*i+1]//2+1,end=' ')
    print((b[2*i+1]-1)//2+b[2*i]//2+1,end=' ')
    for j in range(b[2*i+1]-1):
        print(0,end=' ')

Measured memory_bytes: 4856
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    if (
        S[0] == S[1]
        and S[2] == S[3]
        and S[1] != S[2]
        or S[0] == S[2]
        and S[1] == S[3]
        and S[0] != S[1]
        or S[0] == S[3]
        and S[1] == S[2]
        and S[0] != S[1]
    ):
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8936
n=int(input())
r=input().split()

def BubbleSort(c, n):
    for i in range(n):
        for j in range(n-1, i, -1):
            if int(c[j][-1]) < int(c[j-1][-1]):
                c[j], c[j-1]=c[j-1],c[j]
    return c

def SelectionSort(c, n):
    for i in range(n):
        m=i
        for j in range(i, n):
            if int(c[j][-1]) < int(c[m][-1]):
                m=j
        c[i],c[m]=c[m],c[i]
    return c

l=list(r)
a=BubbleSort(l, n)
print(*a)
print('Stable')
l=list(r)
b=SelectionSort(l, n)
print(*b)
if a==b:
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 5612
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<ll, ll>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 400005;

int a, b, c;

pls give {
    AC; 
    cin >> a >> b >> c;
    swap(a, b); swap(a, c);
    cout << a << ' ' << b << ' ' << c<< nl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

int main(){
    int n,a;
    cin>>n>>a;
    cout<<n*n-a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int A, B, K;
	int mawa;
	
	scanf("%d %d %d", &A, &B, &K);
	
	for(mawa==0; mawa < K; mawa++)
	{
		if(mawa % 2 ==0)
		{
			if (A%2==1) A = A-1;
			A = A / 2;
			B = B + A;
		}
		
		else
		{
			
			if (B%2==1) B = B-1;
			B = B / 2;
			A = A + B;
		}
	}	
	printf ("%d %d", A, B);
	
	return 0;
	}
	

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	stack<int> s;
	int n;
	while(scanf("%d",&n)!=EOF){
		if(n==0){
			cout<<s.top()<<endl;
			s.pop();
		}
		else{
			s.push(n);
		}
	}
	return 0;
}

Measured memory_bytes: 1212
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))
N = int(input())
A = inpl()
B = inpl()
C = inpl()
prev = -1
ans = sum(B)
for i in range(N):
    if A[i] == prev + 1:
        ans += C[prev-1]
    prev = A[i]
print(ans)

Measured memory_bytes: 38384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    vector<string> data(N, " ");
    unordered_map<string, ll> um(N);
    string s;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> s;
        sort(s.begin(), s.end());
        data.at(i) = s;
    }
    for (int i = 0; i < N; i++) {
        um[data.at(i)] += 1;
        ans += um[data.at(i)] - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 13492
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main() {
    string s,t;
    cin>>s>>t;
    rep(i,s.size()){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 3628
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::vector<int> a;
	std::vector<bool> b;
	
	std::cin >> N;
	a.resize(N);
	b.resize(N);
	for (auto& aa : a) {
		std::cin >> aa;
	}

	int cur = 0;
	int n = 0;
	while (!b[cur]) {
		b[cur] = true;
		cur = a[cur] - 1;
		++n;
		if (cur == 1) {
			std::cout << n << "\n";
			return 0;
		}
	}
	std::cout << "-1\n";
}


Measured memory_bytes: 640
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

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

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                 \
  sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(    \
            c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) cerr << boolalpha << i;
  ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
  sim dor(const c &) { ris; }
#endif
}
;
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define memo(dp, val) memset(dp, val, sizeof(dp))
#define NINJA                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define all(a) a.begin(), a.end()
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define dloop(i, n) for (int i = n - 1; i >= 0; i--)
#define iii tuple<int, int, int>
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int, int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main() {
  NINJA;

  int a[4];
  fo(i, 4) cin >> a[i];

  int ans = -inf;
  fo(i, 2) {
    for (int j = 2; j < 4; j++) {
      ans = max(ans, a[i] * a[j]);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N, X, M;
    cin >> N >> X >> M;
    if(X == 0){
        cout << 0 << endl;
        return 0;
    }else if(X == 1){
        cout << N << endl;
        return 0;
    }

    vl used(M);
    ll ans = 0, now = X, sum = 0, T = 0, pi = -1;
    rep(i, N){
        if (used[now]) {
            T = i + 1 - used[now];
            pi = now;

            ll tmp = now;
            rep(j, T){
                sum += tmp;
                tmp = tmp * tmp % M;
            }
            break;
        }
        used[now] = i + 1;
        now = now * now % M;
    }

    if(used[0] == 1){
        sum = 0;
        rep(i, M) if (used[i]) sum += i;
        cout << sum << endl;
        return 0;
    }

    now = X;
    ll c = 0;
    rep(i, N){
        if (now == pi){
            c = i;
            break;
        }
        ans += now;
        now = now * now % M;
    }

    if(pi == -1){
        cout << ans << endl;
        return 0;
    }

    N -= c;
    ans += (N / T) * sum;
    N %= T;
    now = pi;
    rep(i, N){
        ans += now;
        now = now * now % M;
    }

    // err(pi, accumulate(all(used), 0ll), c);
    // now = X;
    // rep(i, 10) {
    //     err(now);
    //     now = now * now % M;
    // }
    cout << ans << endl;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char c[5];
    cin >> c;
    int num[4];
    for (int i = 0; i < 4; i++)
        num[i] = c[i] - '0';
    if (num[0] + num[1] + num[2] + num[3] == 7)
        cout << num[0] << '+' << num[1] << '+' << num[2] << '+' << num[3] << "=7";
    else if (num[0] + num[1] + num[2] - num[3] == 7)
        cout << num[0] << '+' << num[1] << '+' << num[2] << '-' << num[3] << "=7";
    else if (num[0] + num[1] - num[2] + num[3] == 7)
        cout << num[0] << '+' << num[1] << '-' << num[2] << '+' << num[3] << "=7";
    else if (num[0] + num[1] - num[2] - num[3] == 7)
        cout << num[0] << '+' << num[1] << '-' << num[2] << '-' << num[3] << "=7";
    else if (num[0] - num[1] + num[2] + num[3] == 7)
        cout << num[0] << '-' << num[1] << '+' << num[2] << '+' << num[3] << "=7";
    else if (num[0] - num[1] + num[2] - num[3] == 7)
        cout << num[0] << '-' << num[1] << '+' << num[2] << '-' << num[3] << "=7";
    else if (num[0] - num[1] - num[2] + num[3] == 7)
        cout << num[0] << '-' << num[1] << '-' << num[2] << '+' << num[3] << "=7";
    else if (num[0] - num[1] - num[2] - num[3] == 7)
        cout << num[0] << '-' << num[1] << '-' << num[2] << '-' << num[3] << "=7";
    return 0;
}

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

string s;

int stoi(string str){
  stringstream ss(str);
  int n;
  ss >> n;
  return n;
}

int parse(int l, int r){
  int n = 0, i;
  for(int i=r-1;i>=l;i--){
    if(s[i] == ')')n++;
    if(s[i] == '(')n--;
    if(!n){
      if(s[i] == '+')return parse(l,i) + parse(i+1,r);
      if(s[i] == '-')return parse(l,i) - parse(i+1,r);
    }
  }
  for(int i=r-1;i>=l;i--){
    if(s[i] == ')')n++;
    if(s[i] == '(')n--;
    if(!n){
      if(s[i] == '*')return parse(l,i) * parse(i+1,r);
      if(s[i] == '/')return parse(l,i) / parse(i+1,r);
    }
  }

  if(s[l] == '(' && s[r-1] == ')')return parse(l+1,r-1);
  return stoi( s.substr(l,r-l) );
}

int main(){
  int n;
  cin >> n;
  while(n--){
    cin >> s;
    cout << parse(0,(int)s.size()-1) << endl;
  }
}

Measured memory_bytes: 0
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int n,m,x;
    in n>>m>>x;
    vector<int> a(m);
    rep(i,m)in a[i];
    int left=0,right=0;
    for(int i=0;i<m;i++)
    {
        if(a[i]<x)left++;
        else right++;
    }

    cout<<min(left,right)<<endl;
}


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

int main() {
  const uint32_t n_max = 10'000, q_max = 500;
  uint32_t n = 0, q = 0;
  std::array<uint32_t, n_max + 1> S;  // +1 for sentinel
  std::array<uint32_t, q_max> T;
  std::cin >> n;
  for (uint32_t i = 0; i < n; i++) std::cin >> S[i];
  std::cin >> q;
  for (uint32_t i = 0; i < q; i++) std::cin >> T[i];

  uint32_t C = 0;
  for (uint32_t i = 0; i < q; i++) {
    uint32_t j = 0;
    S[n] = T[i];  // set sentinel

    while (T[i] != S[j]) j++;
    if (j != n) C++;
  }

  std::cout << C << std::endl;

  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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; }

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(max(a, b), min(a, b)); }

int main() {
    ll A, B, C, D;  cin >> A >> B >> C >> D;

    ll rc = B / C - (A-1) / C;
    ll rd = B / D - (A-1) / D;
    ll rcd = B / __lcm(C, D) - (A-1) / __lcm(C, D);

    print(B - A + 1 - (rc + rd - rcd));
}

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



int main()
{

	int N, P;
	float M = 0;
	int a[100];
	int b[101] = { 0 };
	cin >> N;

	for (int i = 0; i < N; i++) {

		cin >> a[i];
	}

	sort(a, a + N);

	if (a[0] == a[N - 1]) {
		cout << "0";
		return 0;
	}

	for (int i = 0; i < N; i++) {
		M = M + a[i];
	}


	for (int i = 0; i <= a[N-1]; i++) {
		P = i;
		for (int j = 0; j < N; j++) {

			b[i] = b[i] + (a[j] - P)*(a[j] - P);
		}
		
	}
	sort(b, b + a[N - 1]);

	cout << b[0];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ll long long
#define mp make_pair
#define MAXN 1e6
const int mod=1e9+7;

void solve()
{
  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
  {
    if(i%k==0)
    {
      cout<<"OK"<<endl;
      return;
    }
  }
  cout<<"NG"<<endl;
}

int main()
{
  fastio
  solve();
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b,c=0,d=0,e=0,p;
	cin>>n>>a>>b;
	for(int i=0;i<n;i++){
		cin>>p;
		if(p<=a){
			c++;
		}else if(p>=a+1 && p<=b){
			d++;
		}else if(p>=b+1){
			e++;
		}
	}
	cout<<min({c,d,e})<<endl;
	return 0;
}


Measured memory_bytes: 3584
N,HP=map(int,input().split())

As = [0]*N
Bs = [0]*N
for i in range(N):
    a,b = map(int, input().split())
    As[i] = a
    Bs[i] = b
As.sort(reverse=True)
Bs.sort(reverse=True)

cnt = 0
for b in Bs:
    if As[0] < b:
        HP -= b
        cnt += 1
    else:
        break
    if HP <= 0:
        break

if HP > 0:
    print(cnt + (HP // As[0]) + (HP % As[0] != 0))
else:
    print(cnt)


Measured memory_bytes: 11312
#include "stdio.h"
#include <iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>

using namespace std;
typedef long long int lld;
int arr[1000][1000];
int h,w;
char table[1000][1000];
bool visited[1000][1000];
lld b,W;
int Component;
void DFS(int i, int j){
	if(i<0 || i>=h || j<0 || j>=w)return;
	if(visited[i][j] || arr[i][j]!=Component)return;
	visited[i][j]=true;
	if(table[i][j]=='#')b++;
	else W++;
	DFS(i-1,j);
	DFS(i+1,j);
	DFS(i,j-1);
	DFS(i,j+1);
}
int main(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){visited[i][j]=false;
			cin>>table[i][j];
			if(table[i][j]=='#')arr[i][j]=1;
			else arr[i][j]=0;
			arr[i][j]+=i+j;
			arr[i][j]%=2;
		}
	}
	lld ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			//cout<<arr[i][j];
			if(!visited[i][j]){
				Component=arr[i][j];
				b=0;
				W=0;
				DFS(i,j);
				ans+=b*W;
				//cout<<b<<" "<<W<<endl;
			}
		}//cout<<endl;
	}cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15616
n=int(input())
li=[]
ans=0
for i in range(n):
    li.append(list(map(int,input().split())))

for i in range(n):
    for j in range(i):
        ans+=((li[i][0]-li[j][0])**2+(li[i][1]-li[j][1])**2)**0.5

print(ans*2/n)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;

void solve() {
	int a, b, n;
	cin>>a>>b;
	for(int i=0;i<=a;++i) {
		int p=i;
		int q=a-i;
		if((p*2+q*4==b) || (p*4+q*2==b)) {
			cout<<"Yes\n";
			return;
		}
	}
	cout<<"No\n";
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
    	solve();
    }
    return 0;
}

// ll, reset, 1, bottom

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();

    for (int i = Math.min(a, b); i >= 1; --i) {
      if (a % i == 0 && b % i == 0) {
        --k;
        if (k == 0) {
          System.out.println(i);
          break;
        }
      }
    }

  }
}


Measured memory_bytes: 23764
/*
	##############################
	## Author: Pratyush Gaurav ###
	## College: NIT ROURKELA #####
	##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define rep(i,a) for(i = 0 ; i < a ; i++)
#define repr(i,a) for(i = a ; i >= 0 ; i--)
#define REP(i,a,b) for(i = a ; i <= b ; i++)
#define REPR(i,a,b) for(i = a ; i >= b ; i--)

#define scan(N) scanf("%lld",&N)
#define print(N) printf("%lld",N)
#define scan2(N1,N2) scanf("%lld %lld",&N1,&N2)
#define print2(N1,N2) printf("%lld %lld",N1,N2)
#define scan3(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define print3(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define mem(a,b)memset(a,b,sizeof(a))
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back

#define endl '\n'
#define inf (lli)2000000000000
#define MOD (lli)1000000007
#define MAXN 100005

template<class T> bool is_prime(T n)
{
	if((n%2 == 0 and n > 2) or n < 2 )
		return false;
	for(T i = 3; i*i <= n ; i += 2)
	{
		if( n % i == 0)
			return false;
	}
	return true;
}
lli power(lli a,lli b)
{
    lli value;
    if(!b)
    	return 1;
    else if(b%2==0)
    {
        value = power(a,b/2)%MOD;
        return (value * value)%MOD;
    }
    else
    {
        value = power(a,b/2)%MOD;
        return ((a*value)%MOD*(value))%MOD;
    }
}

int main()
{
	opt;
	string s1,s2;
	cin >> s1 >> s2;
	s1 += s2;
	int num = 0;
	lli i;
	rep(i,s1.length())
        num = num*10 + (s1[i] - '0');
	lli cnt = 0;
//	repr(i,s2.length()-1)
//	{
//        if(s2[i] == '0')
//            cnt++;
//        else
//            break;
//	}
//	if(cnt == 1)
//        num *= 10;
//    else if(cnt == 2)
//        num *= 100;
   // cout << num << endl;
	if((int)sqrt(num)*sqrt(num) == num)
        cout << "Yes";
    else
        cout << "No";
}










Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
int read(){
	int ans=0,f=1,c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1; c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
	return ans*f;
}
const int M=2e5+7;
int n,m,s[2],color[M],vis[M];
int first[M],cnt;
struct node{int to,next;}e[2*M];
void ins(int a,int b){e[++cnt]=(node){b,first[a]}; first[a]=cnt;}
void insert(int a,int b){ins(a,b); ins(b,a);}
bool ly=false;
void dfs(int x){
	vis[x]=1; s[color[x]]++;
	for(int i=first[x];i;i=e[i].next){
		int now=e[i].to;
		if(!vis[now]) color[now]=1-color[x],dfs(now);
		if(vis[now]&&color[now]==color[x]){ly=true; return ;}
	}
}
int main(){
	int x,y;
	n=read(); m=read();
	for(int i=1;i<=m;i++) x=read(),y=read(),insert(x,y);
	dfs(1);
	if(ly) printf("%lld\n",1LL*n*(n-1)/2-m);
	else printf("%lld\n",1LL*s[0]*s[1]-m);
	return 0;
}

Measured memory_bytes: 5376
a,b,ab,x,y=map(int,input().split())
if(a<b):
    mymax=[b,y]
    mymin=[a,x]
else:
    mymax=[a,x]
    mymin=[b,y]


if( 2*ab <= mymin[0]):
    print( 2*ab*max([x,y]) )
elif(2*ab <=mymax[0]):
    if(max([x,y]) ==mymax[1]):
        nedan=ab*2*mymax[1]
    else:
        nedan=ab*2*min([x,y]) + (mymin[1]-mymax[1])*mymin[0]
    print(nedan)
elif(2*ab <=a+b):
    if(mymax[1]==max([x,y])):
        print(2*ab*mymin[1] + mymax[0]*(mymax[1]-mymin[1]))
    else:
        print(2*ab*mymax[1] + mymin[0]*(mymin[1] - mymax[1]) )
else:
    print(a*x+b*y)

Measured memory_bytes: 3064
#include <stdio.h>

int DigitSum(int x){
	return x%10 + (x/10)%10 + (x/100)%10 + (x/1000)%10 + (x/10000)%10;
}

int main(){
	int N,A,B,K,i;
	scanf("%d %d %d",&N,&A,&B);

	for(i = 1; i <= N; i++){
		if(A <= DigitSum(i) && DigitSum(i) <= B){
			K += i;
		}
	}

	printf("%d\n",K);

	return 0;
}

Measured memory_bytes: 128
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toSeq.init
    in.foreach(d => {
        val x = 7200-d(0)*3600-d(1)*60-d(2)
        println("%02d:%02d:%02d".format(x/3600, x/60%60, x%60))
        println("%02d:%02d:%02d".format(x/1200, x/20%60, x*3%60))
    })
}

Measured memory_bytes: 44404
#include <cstdio>
#include <algorithm>
#include <cstring>

typedef long long ll;

char s[100005]; int n;

int main() {
	scanf("%s", s + 1); n = strlen(s + 1);
	
	int ans = 0;
	for (int i = 2; i <= n; ++i) ans += (s[i] != s[i - 1]);
	
	printf("%d\n", ans);
	
	return 0;
}


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

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

    int a,b;
    cin >> a >> b;
    if(a<=2*b) cout << 0 << endl;
    else cout << a - 2 * b << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

struct FordFulkerson{
    struct Edge {
        int to,cap,rev;
        Edge(int to=0,int cap=0,int rev=0) :
            to(to),cap(cap),rev(rev){}
    };

    int V;
    vector<vector<Edge> > G;
    vector<bool> used;

    FordFulkerson(int V) : V(V) {
        G.resize(V);
        used.assign(V,false);
    }

    void add_edge(int from,int to,int cap) {
        G[from].pb(Edge(to,cap,G[to].size()));
        G[to].pb(Edge(from,0,G[from].size()-1));
    }

    int dfs(int v,int t,int f) {
        if(v==t) return f;
        used[v]=true;
        for(int i=0;i<G[v].size();i++) {
            Edge &e=G[v][i];

            if(!used[e.to] && e.cap>0) {
                int d=dfs(e.to,t,min(f,e.cap));
                if(d>0) {
                    e.cap-=d;
                    G[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int max_flow(int s,int t) {
        int flow=0;
        while(1) {
            used.assign(V,false);
            int f=dfs(s,t,INF);
            if(f==0) break;
            flow+=f;
        }

        return flow;
    }
    void dump() {
        rep(i,V) {
            printf("%d size=%d\n",i,G[i].size());
            rep(j,G[i].size()) {
                Edge e=G[i][j];
                printf(" %d->%d cap:%d rev=%d\n",i,e.to,e.cap,e.rev);
            }
        }
    }
    void func(set<int> S[],vector<P> &ans) {
        rep(i,V) {
            rep(j,G[i].size()) {
                Edge e=G[i][j];
                if(e.cap==0) {
                    if(!S[i].count(e.to)) ans.pb(P(e.to,i));
                }
            }
        }
        sort(all(ans));
        ans.erase(unique(all(ans)),ans.end());
    }
};
int n,m;
int s,t;
int main() {
    cin>>n>>m;
    FordFulkerson ff(n);
    set<int> S[300];
    map<P,int> in;
    rep(i,m) {
        int x,y;
        cin>>x>>y;
        x--,y--;
        ff.add_edge(x,y,1);
        ff.add_edge(y,x,1);
        S[x].insert(y);
        in[P(x,y)]=i+1;
    }
    cin>>s>>t;
    s--,t--;
    cout<<ff.max_flow(s,t)<<endl;
    vector<P> ans;
    ff.func(S,ans);
    cout<<ans.size()<<endl;
    rep(i,ans.size()) cout<<in[ans[i]]<<endl;
    return 0;
}

Measured memory_bytes: 1436