akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
public class Main
{
 static Hashtable<String ,Integer>hash=new Hashtable<>();
  public static void main(String args[]) throws java.lang.Exception
  {
    MyScanner sc = new MyScanner();
  
     //  hash=new Hashtable<>();

    int n=Integer.parseInt(sc.nextLine());
    Hashtable<String,Integer>hash=new Hashtable<>();
    // long c=0;
    // int gcd[][]=new int[n+1][n+1];
    // for(int i=1;i<=n;i++)
    // {
    //   for(int j=i;j<=n;j++)
    //   {
    //     gcd[i][j]=gcd1(i,j);
    //   }
    // }
    long c=0;
    for(int k=1;k<=n;k++)
    {
      for(int i=1;i<=n;i++)

      {
        int kk=gcd1(i,k);
        for(int j=1;j<=n;j++)
        {
          c+=(long)gcd1(kk,j);
        }


        }
      }
    
    System.out.println(c);
       
     
     
   }
   static int gcd1(int a, int b)
   {
    return func(Math.min(a,b),Math.max(a,b));
   }
   static int func(int a, int b)
   {
    if(a==0){return b;}
    return func(b%a,a);
   }
     
  
  

  
  }

   class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
    try {
       str = br.readLine();
    } catch (IOException e) {
       e.printStackTrace();
    }
    return str;
      }
 
   }

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

int main(void) {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    for (int i = sx; i < tx; i++)
        cout << 'R';
    for (int i = sy; i < ty; i++)
        cout << 'U';
    for (int i = sx; i < tx; i++)
        cout << 'L';
    for (int i = sy; i < ty; i++)
        cout << 'D';
    cout << 'L';
    for (int i = sy; i <= ty; i++)
        cout << 'U';
    for (int i = sx; i <= tx; i++)
        cout << 'R';
    cout << 'D';
    cout << 'R';
    for (int i = sy; i <= ty; i++)
        cout << 'D';
    for (int i = sx; i <= tx; i++)
        cout << 'L';
    cout << 'U';
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
string s[100];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    getchar();
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    sort(s,s+n);
    for(int i=0;i<n;i++)
        cout<<s[i];
    printf("\n");
    return 0;
}



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

 int main () {
   int a,b;
   cin >> a >> b;
   
   int c=b-a;
   int d=c/2;
   
   if (c%2!=0) {
     cout << "IMPOSSIBLE" << endl;
   }
   else {
     cout << a+d << endl;
   }
 }


Measured memory_bytes: 3612
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int out = 0;
        int a = scan.nextInt();
        int b = scan.nextInt();
        out = Math.max(a + b, a - b);
        out = Math.max(out, a * b);
        System.out.println(out);
    }
}

Measured memory_bytes: 21460
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n, in;
    cin >> n;
    int ans = 0;
    REP(i,0,n) {
        cin >> in;
        while (in % 2 == 0) {
            ++ans;
            in /= 2;
        }
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n;
	while(cin>>n,n){
		vector<pii>in;
		while(n--){
			int a,b;
			cin>>a>>b;
			in.pb(pii(a,b));
		}
		cin>>n;
		while(n--){
			int a,b;
			cin>>a>>b;
			in.pb(pii(a,b));
		}
		sort(all(in));
		n=in.size();
		vi dp(210,1);
		loop(i,1,n){
			int ma=0;
			rep(j,i)if(in[j].first<in[i].first&&in[j].second<in[i].second)
				ma=max(ma,dp[j]);
			dp[i]+=ma;		
		}
		int ma=0;
		rep(i,n)ma=max(ma,dp[i]);
		cout<<ma<<endl;
	}
}

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

int main(){
  double n,m,ans=0;
  cin>>n;
  rep(i,n){
    cin>>m;
    m=1/m;
    ans+=m;
  }
  cout<<fixed<<setprecision(8);
  ans=1/ans;
  cout<<ans;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int h,w,k;
    int ans=0;
    int tcnt=0;
    cin >> h >> w >> k;
    vector<string> mappu;
    rep(i,h){
        string s;
        cin >> s;
        mappu.push_back(s);
    }
    vector<bool> tate(h,true);
    vector<bool> yoko(w,true);

    rep(bit1,1<<h){
        rep(bit2, 1<<w){
            vector<bool> gyou(h,true);
            vector<bool> retu(w,true);
            int cnt=0;
           // tcnt++;
    
        rep(i,h){
            if(bit1>>i&1){
                gyou[i] = false;
            }
        }
        rep(j,w){
            if(bit2>>j&1){
                retu[j] = false;
            }
        }
        rep(i,h){
            rep(j,w){
                if(gyou[i] == true && retu[j] == true && mappu[i][j] =='#') cnt++;
            }
        }
        if(cnt == k) ans++;
    }
  }
    cout << ans << endl;
}

Measured memory_bytes: 3604
a = list(input())
total = 0
if a[0] == "R":
    total += 1
    if a[1] == "R":
        total += 1
        if a[2] == "R":
            total += 1
elif a[1] == "R":
    total += 1
    if a[2] == "R":
        total += 1
elif a[2] == "R":
    total += 1
print(total)


Measured memory_bytes: 61632
def p_ans(a,l)
  if a == "Vacant"
    exit
  end
end

n = gets.to_i
l,r = 0,n-1
puts l
STDOUT.flush
a = gets.chomp
p_ans(a,l)
puts r
STDOUT.flush
b = gets.chomp
p_ans(b,r)

def solve(a,b,l,r)
  m = (r+l)/2
  puts m
  STDOUT.flush
  c = gets.chomp
  p_ans(c,m)
  if ((m-l)%2 == 1) == (a == c)
    solve(a,c,l,m)
  else
    solve(c,b,m,r)
  end
end

solve(a,b,l,r)

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n;
    cin>>n;
    vc<string> st(n);
    rep(i,n)cin>>st[i];

    map<string,int> m;
    int num=0;
    rep(i,n){
        m[st[i]]++;
        cmax(num,m[st[i]]);
    }

    vc<string> ans;
    for(auto it=m.begin();!(it==m.end());it++){
        if((it->second)==num)ans.push_back(it->first);
    }

    sort(all(ans));

    rep(i,ans.size()){
        cout<<ans[i]<<"\n";
    }

    return 0;
}

Measured memory_bytes: 28404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int times[1005];
int main()
{
	int n;cin>>n;vector< vector<int> > a(n,vector<int>(n-1));
	int x;queue<int> q;
	for(int i=0;i<n;i++)
	{
		for(int j=n-2;j>=0;j--)
		{
			scanf("%d",&a[i][j]);
			a[i][j]--;
		}
		q.push(i);
	}
	int flag=1;int sz=n*(n-1)/2;set< pair<int,int> > se;int now=0;
	
	while(!q.empty())
	{
		int now=q.front();q.pop();
		if(sz==0) break;
		int x=a[now].back();
		if(now>x) swap(now,x);
		pair<int,int> tmp={now,x};
		if(se.find(tmp)==se.end())
		{
			se.insert(tmp);
		}
		else
		{
			int nn=max(times[tmp.first],times[tmp.second]);
			times[tmp.first]=nn+1;times[tmp.second]=nn+1;
			a[tmp.first].pop_back();
			a[tmp.second].pop_back();
			q.push(tmp.first);
			q.push(tmp.second);
			se.erase(tmp);sz--;
		}
	}
	int ans=0;
	for(int i=0;i<=n-1;i++) ans=max(ans,times[i]);
	if(sz==0) cout<<ans<<endl;
	else cout<<-1<<endl;
}

Measured memory_bytes: 4224
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int result = 0;
    
    for(int i=0; i<S.length(); i++){
      if(S.charAt(i) != (T.charAt(i))){
        result++;
      }
    }
    
    System.out.println(result);
  }
}

Measured memory_bytes: 41136
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  set<char> ss;
  REP(i, s.size()) {
    ss.insert(s[i]);
  }
  
  cout << (ss.size() == s.size() ? "yes" : "no") << endl;
  return 0;
}

Measured memory_bytes: 256
/*  /$$                                     /$$
      | $$                                    | $$
  /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$ /$$_____/ /$$__  $$ /$$__  $$ /$$__  $$ /$$__  $$
| $$  | $$| $$$$$$$$| $$      | $$  \ $$| $$  | $$| $$$$$$$$| $$  \__/
| $$  | $$| $$_____/| $$      | $$  | $$| $$  | $$| $$_____/| $$
|  $$$$$$$|  $$$$$$$|  $$$$$$$|  $$$$$$/|  $$$$$$$|  $$$$$$$| $$
 \_______/ \_______/ \_______/ \______/  \_______/ \_______/|__//$$$$$$ /$$$$$$
                                                               |______/|______/

*/
#include <bits/stdc++.h>
#define fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ln            cout<<endl;
#define vi            vector<int>
#define vll           vector<long long>
#define sortl(vec)    sort(vec.begin(), vec.end());
#define sortr(vec)    sort(vec.rbegin(), vec.rend());
#define forn(i, x, n) for(long long i = x; i < n; i++)
#define revn(i, n, x) for(long long i = n; i >= x ; i--)
#define in(vec)       for(auto &it : vec) cin >> it;
#define loop(vec)     for(auto &it : vec)
#define	out(vec)      for(auto &it : vec) cout << it << " "; ln
#define ll            long long
#define mod           1000000007
#define debug(x)      cout << x << endl;
#define pb            emplace_back
#define mp            make_pair
#define um            unordered_map
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define f             first
#define s             second
#define pi            3.14159265359
#define CLOCK         cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
using namespace std;

ll power(ll x, ll y, ll p) {
	ll res = 1;
	x = x % p;

	while (y > 0) {
		if (y & 1)
			res = (res * x) % p;

		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

ll modulo(ll a, ll b) {
	ll c = a % b;
	return (c < 0) ? c + b : c;
}

int main() {
// in(vec) works for size-defined type vectors

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif

	fastio
	ll t = 1;
	while (t--) {
		vll vec(6);

		forn(i, 1, 6) {
			cin >> vec[i];
		}

		forn(i, 1, 6)
		if (vec[i] != i) {
			cout << i << endl;
			break;
		}


	}
	CLOCK
	return 0;
}



Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define pq priority_queue
using namespace std;
int main () {
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%lld", &a);
	if (a < 1200) printf("ABC\n");
	else printf("ARC\n");
	return 0;
}

Measured memory_bytes: 764
# -*- coding: utf-8 -*-
from itertools import accumulate


def main(N, K, S):
    cnts = []
    now = '1'
    cnt = 0
    for n in S:
        if now == n:
            cnt += 1
        else:
            cnts.append(cnt)
            cnt = 1
            now = n
    cnts.append(cnt)

    if now == '0': cnts.append(0)
    
    ans = 0
    Add = 2 * K + 1

    sums = [0] + list(accumulate(cnts))

    for i in range(0,len(cnts),2):
        left = i
        right = min(i + Add, len(cnts))
        tmp = sums[right] - sums[left]

        ans = max(tmp, ans)
    print(ans)

if __name__ == "__main__":
    n, k = list(map(int, input().split()))
    s = input()
    main(n, k, s)


Measured memory_bytes: 8820
#include <bits/stdc++.h>
#include <iostream>
#include<math.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; }
using Graph = vector<vector<int>>;
int N, M;
Graph G;

void solve() {
    vector<int> dist(N, -1);
    vector<int> prev(N, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i) cout << prev[i] + 1 << endl;
}
int main()
{
    cin >> N >> M;
    G.assign(N, vector<int>());
    for (int i=0; i<M; i++) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    solve();
    return 0;
}

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

class Program {
    static void Main(string[] args) {
        int N;
        Input(out N);
        string S;
        Input(out S);
        S = S.Replace("ABC", "$");
        int count = 0;
        foreach(char c in S) {
            if(c.Equals('$')) {
                count++;
            }
        }
        Console.WriteLine(count);
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
    IOS;

    float d,t,s;
    cin >> d >> t >> s;
    if(d/s > t) cout << "No\n";
    else cout << "Yes\n";
    return 0;    
}

Measured memory_bytes: 3736
N = int(input())
hoge = input().split()
p = []
q = []
for i in range(N):
  p.append(i)
  q.append(int(hoge[i]) - i)

if q.count(1) == N-2 or q.count(1) == N:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
#ライブラリの読み込み
import math

#曜日リスト作成
list_day = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

#入力値の格納
s = input()

#日数の判別
text = 7 - list_day.index(s)

#結果の表示
print(text)

Measured memory_bytes: 2940
function *main() {
  let N = Number(yield);
  var ac=0, wa=0, tle=0, re=0;
  for(let i=0; i<N; i++){
    let S = (yield);
    switch(S){
      case "AC": ac++;break;
      case "WA": wa++;break;
      case "TLE": tle++;break;
      case "RE": re++;break;
    }
  }
  console.log("AC x "+ac);
  console.log("WA x "+wa);
  console.log("TLE x "+tle);
  console.log("RE x "+re);
}
const iter = main();
iter.next();
require("readline").createInterface(
  {input: process.stdin, output: process.stdout}
).on("line", line => iter.next(line));

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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

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 che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める

int main()
{
	cout <<setprecision(10);
	//例えば(N,M) (2,4)のとき、8文字にしても4文字にしても、被る（同じ要素番号）ところは変わらないので4のほうがいい。

	ll N , M ;
	cin >> N >> M;
	string S , T;
	cin >> S >> T; //S長さN, T長さM

	//最小公倍数
	ll G = __gcd(N,M);
	ll L = N*M / G;

	if(S==T){
		cout << L << endl;
		return 0 ;
	}
	map<ll,char> for_S;
	map<ll,char> for_T;

	//map作成
	int i = 0;
	int k = L / N;
	while(1){
		for_S[k*i] = S[i];
		i++;
		if(i>N) break;
	}
	i =0 ;
	k = L / M;
	while(1){
		for_T[k*i] = T[i];
		i++;
		if(i>M) break;
	}

	for(auto x:for_S){
		//x.firstについてfor_tに存在しているか
		//存在しているならば、一致しているか
		if(for_T.count(x.first)){
			if(for_T[x.first] == x.second){
				//一致してればおけ
			}else {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	for(auto x:for_T){
		//x.firstについてfor_tに存在しているか
		//存在しているならば、一致しているか
		if(for_S.count(x.first)){
			if(for_S[x.first] == x.second){
				//一致してればおけ
			}else {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << L << endl;
	
}

//-1になるときの処理が足りてないらしい


Measured memory_bytes: 10880
using System;
class Probrem{
    static void Main(){
        while(true){
            string str = Console.ReadLine();
            string[] stArray = str.Split(' ');
            int[] intArray = new int[3];
            int i, j;
            for(i=0;i<3;i++){
                intArray[i] = int.Parse(stArray[i]);
            }
            if(intArray[1] == 0 && intArray[2] == 0 && intArray[0] == 0){
                return; 
            }
            int[] sides1 = new int[1000];
            int[] sides2 = new int[1000];
            int[] height = new int[1000]; //stock each sides data in these arrays.
            string stmp;
            string[] arrtmp = new string[3];
            
            //get input in this loop.
            for(i=0;i<intArray[1];i++){
                stmp = Console.ReadLine();
                arrtmp = stmp.Split(' ');
                height[i] = int.Parse(arrtmp[0]);
                sides1[i] = int.Parse(arrtmp[1]);
                sides2[i] = int.Parse(arrtmp[2]);
            }
            //get answer in this loop.
            for(i=1000;i>=0;i--){
                for(j=0;j<intArray[1];j++){
                    if(height[j] != i){
                        continue;
                    }else{
                        if(sides1[j] == intArray[2]){
                            intArray[2] = sides2[j];
                            break;
                        }else if(sides2[j] == intArray[2]){
                            intArray[2] = sides1[j];
                            break;
                        }
                    }
                }
            }
            Console.WriteLine(intArray[2]);
        }
    }
}

Measured memory_bytes: 9304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(b-1, n);
    cout << (a*x)/b << endl;
}


Measured memory_bytes: 3560
#include <iostream>
using namespace std;
int main(void){
    int A,B,C,X;
    cin>>A>>B>>C>>X;
    int res=0;
    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                if(500*i+100*j+50*k==X) res+=1;
            }
        }
    }
    printf("%d",res);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;

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

#define pb push_back
#define fr first
#define sc second

int f(int x){
	if(x < 10)return x;
	return x%10+f(x/10);
}

int main(){
	int K;
	cin >> K;
	
	while(K%2 == 0)K /= 2;
	while(K%5 == 0)K /= 5;
	
	if(K == 1){
		printf("%d\n",1);
		return 0;
	}
	
	vector<int> R;
	int r = 1;
	do{
		r *= 10;
		while(r > K)r -= K;
		R.pb(r);
	}while(r != 1);
	sort(R.begin(),R.end());
	reverse(R.begin(),R.end());
	
	int t = 1000000;;
	int used[100010];
	queue<P> que;
	for(int i = 0 ; i < 100010 ; i ++)used[i] = 1000000;
	que.push(P(0,K));
	used[K] = 0;
	while(!que.empty()){
		P p = que.front(); que.pop();
		if(p.fr+1 >= t)continue;
		for(int i = 0 ; i < R.size() ; i ++){
			int nex = p.sc+K-R[i];
			if(nex >= K)nex -= K;
			if(used[nex] == 1000000){
				used[nex] = p.fr+1;
				if(used[K-nex] != 1000000)t = p.fr+1;
				if(p.fr+1 < t)que.push(P(p.fr+1,nex));
			}
		}
	}
	
	int ret = 1000000;
	for(int i = 1 ; i <= K-i ; i ++){
		ret = min( ret , used[i]+used[K-i] );
	}
	cout << ret << endl;
}



Measured memory_bytes: 1276
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    static void printAns(int num, ArrayList<Integer> ans) {
        Collections.sort(ans);
        String[] ansArray = new String[ans.size()];

        for (int i = 0; i < ansArray.length; i++)
            ansArray[i] = ans.get(i).toString();

        String joined = String.join(" ", ansArray);
        System.out.println(num + ": " + joined);
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num;
        // ?´???°??¨?????????
        List<Integer> primeList = new ArrayList<>();

        boolean[] primeArray = new boolean[300001];
//        System.out.println(primeArray[299998]);
        for (int i = 1; i < 300000; i++) {
            if (i % 7 == 1 || i % 7 == 6)
                primeArray[i] = true; // ?????????????´???°
        }
//        System.out.println(primeArray[299998]);
        for (int i = 1; i < Math.sqrt(300000 + 1)/7 + 1; i++) {
            for (int j = i+1; j < 300000/7 + 1; j++) {
                if ((7*j-1) % (7*i+1) == 0)
                    primeArray[7*j-1] = false;
                if ((7*j+1) % (7*i+1) == 0)
                    primeArray[7*j+1] = false;
                if ((7*j-1) % (7*i-1) == 0)
                    primeArray[7*j-1] = false;
                if ((7*j+1) % (7*i-1) == 0)
                    primeArray[7*j+1] = false;
            }
        }
        for (int i = 1; i < 300000/7 + 1; i++) {
            if (primeArray[7*i-1])
                primeList.add(7*i-1);
            if (primeArray[7*i+1])
                primeList.add(7*i+1);
        }
//        System.out.println(primeList.contains(299998));
        // done

        while (true) {
            num = sc.nextInt();
            ArrayList<Integer> ans = new ArrayList<>();
            if (num == 1) break;


            for (int prime: primeList) {
                if (num % prime == 0)
                    ans.add(prime);
            }

            printAns(num, ans);
        }

    }

}

Measured memory_bytes: 32876
#include <stdio.h>

typedef long long ll;

/////////////         modの計算
constexpr ll mod = 1000000007;
constexpr ll M = mod * mod;

constexpr int K = 16;

constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };
constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

int main() {
	int T; scanf("%d", &T);
	for (int _t = 0; _t < T; _t++) {
		ll N; scanf("%lld", &N);
		ll ans = 0, x = 1;

		if (N & 1) {// odd
			for (int i = 0; i < K; i++) {
				ans += x * v_o[i];
				x *= N;
				if (ans >= M) { ans -= M; }
				if (x >= mod) { x %= mod; }
			}
		}
		else {// even
			for (int i = 0; i < K; i++) {
				ans += x * v_e[i];
				x *= N;
				if (ans >= M) { ans -= M; }
				if (x >= mod) { x %= mod; }
			}
		}
		printf("%lld\n", ans % mod);
	}

	return 0;
}


Measured memory_bytes: 1684
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
const int INF = 1e9;
template <class T> T Next() { T buf; cin >> buf; return buf; }

const int MOD = 1000000007;
int n, m;
int dp[51][51][1301];
void add(int& a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

int main() {
  cin >> n >> m;
  if (m % 2 == 1 || m * 2 > n * n) {
    cout << 0 << endl;
    return 0;
  }
  
  dp[0][0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int k = 0; k <= i; ++k) {
      for (int p = 0; p <= i * (i + 1) / 2; ++p) {
        long v = dp[i][k][p];
        add(dp[i + 1][k + 1][p + k], v);
        add(dp[i + 1][k][p + k], (2 * k + 1) * v % MOD);
        if (k > 0) {
          add(dp[i + 1][k - 1][p + k], k * k * v % MOD);
        }
      }
    }
  }
  
  cout << dp[n][0][m / 2] << endl;
  return 0;
}

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

int main(){
  int h,w;
  while(1){
     cin >> h >> w;
     if (( h == 0 && w == 0)||( h > 300 || w > 300))break;
       for (int i=1 ; i <= h ; i++){
	 for (int j=1 ; j <= w ; j++){
	   cout << "#";
	 }
	 cout << endl;
       }
       cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1152
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 5e2+5;

int n;
int m;
int q;
multiset < int > st[N];
vector < int > stbv[N];

int main(){
    scanf("%d%d%d" , &n , &m , &q);
    for(int i = 1; i <= m; i++){
        int l , r;
        scanf("%d%d" , &l , &r);
        st[l].insert(r);
    }
    for(int i = 1; i <= n; i++){
        for(auto v : st[i]){
            stbv[i].push_back(v);
        }
    }
    while(q--){
        int a , b;
        scanf("%d%d" , &a , &b);
        int cnt = 0;
        for(int i = a; i <= b; i++){
            cnt += upper_bound(stbv[i].begin() , stbv[i].end() , b) - stbv[i].begin();
        }
        printf("%d\n" , cnt);
    }

}

Measured memory_bytes: 11520
N,K = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
k = 0
B = []
for i in range(N):
    l = int(K*A[i]/S)
    k += l
    B.append([A[i]/(l+1),l+1])
L = K-k
B.sort(reverse = True)
if L == 0:
    if B[0][0].is_integer():
        print(int(B[0][0]))
    else:
        print(int(B[0][0])+1)
else:
    M = B[0][0]*B[0][1]/(B[0][1]+1)
    for i in range(1,L):
        b= B[i][0]*B[i][1]/(B[i][1]+1)
        if b > M:
            M = b
    if M < B[L][0]:
        M = B[L][0]
    if M.is_integer():
        print(int(M))
    else:
        print(int(M)+1)

Measured memory_bytes: 108068
<?php
/*
    Problem URL : https://beta.atcoder.jp/contests/abc063/tasks/abc063_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */


// define('DEBUG', true);
define('DEBUG', false);

ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d %d", $A, $B);

if ($A + $B >= 10) {
    echo "error\n";
} else {
    echo ($A + $B) . PHP_EOL;
}


Measured memory_bytes: 4604
h,w = map(int, input().split())
a = list(map(int, input().split())) + [0]
b = list(map(int, input().split())) + [0]
mod = 10**9 + 7
a.sort(reverse=True)
b.sort(reverse=True)
if len(set(a)) <= h or len(set(b)) <= w:
  print(0); exit(0)
cnt = 1
ai,bi = 0,0
for i in range(h*w,0,-1):
  while a[ai] > i: ai += 1
  while b[bi] > i: bi += 1
  if a[ai] == b[bi] == i: pass
  elif a[ai] == i: cnt *= bi
  elif b[bi] == i: cnt *= ai
  else: cnt *= ai*bi - h*w + i
  cnt %= mod
print(cnt)

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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rell(i,n) for (ll i=0; i< (ll)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());

string yes="Yes",no="No";

ll mod=1e9+7;

int main() {
 ll s;
 cin>>s;
 if(s<3){
     cout<<0<<endl;
     return 0;
 }
 ll ma=s/3;
 ll ans=0;
 vll rev(s-3);
 bitset<32> mo(mod-2);
 rep(i,s-3){
     ll re=(i+1);
     ll gen=1;
     rep(j,32){
         if(mo[j]==1){
             gen*=re;
             gen%=mod;
         }
         re=re*re;
         re%=mod;
     }
     rev[i]=gen;
 }

 
 for(ll i=1;i<ma+1;i++){
     ll me=1;
     rep(j,s-3*i){
         me*=(s-2*i-1-j);
         me%=mod;
     }
     
     rep(j,s-3*i){
         me*=rev[j];
         me%=mod;
     }
     
     ans+=me;
     ans%=mod;
     
 }
 cout<<ans<<endl;
    
}


Measured memory_bytes: 3628
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    let k = read::<i64>();
    for i in (k-n+1)..(k+n) {
        print!("{} ", i);
    }
}

Measured memory_bytes: 4352
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int m = saori.saori_hayami();
		int x = saori.saori_hayami();
		int count = 0;
		int num = 0;
		for(int i = 0;i < m;i++){
			num = saori.saori_hayami();
			if(num < x){
				count++;
			} 
		}
		if(m - count >= count){
			System.out.println(count);
		} else {
			System.out.println(m-count);
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a.at(i);
    sort(a.begin(),a.end());
    a.erase(unique(a.begin(),a.end()),a.end());
    cout<<a.size()<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include <math.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll) 1 << 62;
const ll MOD = 1000000007, INF = 1e18;

int main(void) {
    int n, a, b;
    cin >> n >> a >> b;
    vi x(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    ll ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        ll walk_cost = (ll) (x[i + 1] - x[i]) * a;
        if (walk_cost < (ll) b) {
            ans += walk_cost;
        } else {
            ans += (ll)b;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  for (auto &r : a) {
    for (auto &e : r) {
      cin >> e;
    }
  }

  vector<pair<pair<int, int>, pair<int, int>>> v;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w - 1; j++) {
      if (a[i][j] % 2) {
        v.push_back({{i, j}, {i, j + 1}});
        a[i][j]--;
        a[i][j + 1]++;
      }
    }
  }
  for (int i = 0; i < h - 1; i++) {
    if (a[i][w - 1] % 2) {
      v.push_back({{i, w - 1}, {i + 1, w - 1}});
      a[i][w - 1]--;
      a[i + 1][w - 1]--;
    }
  }

  cout << v.size() << endl;
  for (auto e : v) {
    auto s = e.first, d = e.second;
    cout << s.first + 1 << " " << s.second + 1 << " " << d.first + 1 << " " << d.second + 1 << endl;
  }
}


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


int main(){
    int K, N;
    int *A;
    cin >> K >> N;
    
    int i;
    int *D;
    int max_d = -1;
    int max_i = -1;
    int d;
    A = new int[N];
    D = new int[N];
    for (i=0;i<N;i++){
        cin >> A[i];
        if (i > 0){
            int d = A[i] - A[i-1];
            D[i-1] = d;
            if (d > max_d){
                max_i = i;
                max_d = d;
            }
        }
        if (i == N-1){
            int d = A[0] + K - A[N-1];
            D[N-1] = d;
            if (d > max_d){
                max_i = i;
                max_d = d;
            }
        }
    }

    int out = K - max_d;
    cout << out << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#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 sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

ll N,A,B;
vector<ll> H;

bool isok(ll x){
  // code here
  ll add = 0;
  ll dall = B*x;
  ll pls = A-B;
  rep(i,N){
    ll hp = H[i]-dall;
    if(hp>0) add += (hp+pls-1)/pls;
  }

  if(add<=x) return true;
  else return false;
}
ll binsch(){
  // set value
  ll ng = 0; ll ok = 1e9+10;
  while(abs(ok-ng)>1){
    ll mid = (ok+ng)/2;
    if(isok(mid)) ok = mid;
    else ng = mid;
  }
  return ok;
}

int main(){
  cin >> N >> A >> B;
  H.resize(N); rep(i,N) cin >> H[i];
  cout << binsch() << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	// s点以上となる最小の問題数を返す。（u はiごとの問題数）
	int res(int[] u, int s) {
		int ans = 0;
		for(int i=D;i>=1;i--) {
			if(u[i]*i*100 >= s) {
				return ans + (int)Math.ceil((double)s/(i*100));
			}else {
				ans += u[i];
				s -= u[i]*i*100;
			}
		}
		//全部といてもsに届かない
		return Integer.MAX_VALUE;
	}
	
	// cmp[i]をコンプリートしたときの最小の問題数
	int res2(boolean[] cmp) {
		int ans = 0;
		int score = 0;
		//コンプリートした問題の点数の合計とコンプリートボーナス
		for(int i=1;i<=D;i++) {
			if(cmp[i]) {
				ans += p[i];
				score += p[i]*i*100 + c[i];
			}
		}
		
		if(score >= G) {
			return ans;
		}
		
		//それ以外の問題で最小の
		int[] np = new int[D+1];
		System.arraycopy(p, 0, np, 0, D+1);
		for(int i=1;i<=D;i++) {
			if(cmp[i]) {
				np[i] = 0;
			}
		}
		
		int r = res(np, G-score);
		return r ==Integer.MAX_VALUE ? r : ans + r;
		
	}
	
	int D,G;
	int[] p,c;
	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		D = sc.nextInt();
		G = sc.nextInt();
		
		p = new int[D+1];
		c = new int[D+1];
		
		for(int i=1;i<=D;i++) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		
		int ans = Integer.MAX_VALUE;
		
		for(int x=1;x<= 1<<(D+1);x++) {
			boolean[] cm = new boolean[D+1];
			for(int i=1;i<=D;i++) {
				cm[i] = ((x>>i &0x01) == 1);
			}
			ans = Math.min(ans, res2(cm));
		}
		
		out.println(ans);
		
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 23636
import java.util.*;
class Main{
	static Scanner scan = new Scanner(System.in);
	static void crackers(){
		int n = scan.nextInt(), k = scan.nextInt();
		int m;
		if(n%k==0)
			m = 0;
		else
			m = 1;
		System.out.println(m);
	}
	public static void main(String[] argv){
		crackers();
	}
}

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

int main() {
  string s;
  cin >> s;
  int N=s.size();
  if (N%2!=0) cout << "No" << endl;
  else {
    vector<char> w(N);
    for (int i=0; i<N; i++) w.at(i)=s.at(i);
    sort(w.begin(),w.end());
    for (int i=0; i<N/2; i++) {
      if (w.at(i*2)!=w.at(i*2+1)) {
        cout << "No" << endl;break;
      }
      else if (i==N/2-1) cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAX_N=1e5;
int N,M;
int f[MAX_N+1];
bool is_f[MAX_N+1];
int ans;
int find(int x){return f[x]?f[x]=find(f[x]):x;}
void merge(int x,int y)
{
	int fx=find(x);
	int fy=find(y);
	if(fx!=fy)
		f[fx]=fy;
	return;
}
int main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int X,Y,Z;
		cin>>X>>Y>>Z;
		merge(X,Y);
	}
	for(int i=1;i<=N;i++)
		is_f[find(i)]=true;
	for(int i=1;i<=N;i++)
		ans+=is_f[i];
    cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main() {
	string a, b, c,s;
	cin >> a >> b>>c;
	s += a[0];
	s += b[0];
	s += c[0];
	transform(s.begin(), s.end(), s.begin(), ::toupper);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using pint = pair<int, int>;
using pll = pair<ll,ll>;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n,h;
    cin >> n >> h;
    vector<int> a(n),b(n+1);
    ll ans=0;
    REP(i,n){
        cin >> a[i] >> b[i];
    }
    b.push_back(0);
    sort(a.begin(),a.end(),greater<>());
    sort(b.begin(),b.end(),greater<>());
    int cut_max=a[0],index=0,count=0;
    while(h>0){
        if(cut_max<b[index]){
            h-=b[index];
            index++;
            count++;
        }
        else{
            count += (h+cut_max-1)/cut_max;
            break;
        }
    }
    COUT(count);
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <valarray>
#include <iomanip> //setprecision使うときに必要
using std::cin;
using std::cout;
using std::endl;
using std::valarray;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++) //forにするとエラー

int main()
{
    int n, p = 0;
    ld D[6];
    cin >> n;
    valarray<ld> x(0.0, n);
    valarray<ld> y(0.0, n);
 

    rep(i, n)
        cin >> x[i];
    rep(i, n)
        cin >> y[i];

    while (p != 5)
    {
        valarray<ld> x_y(0.0, n);
        p++;

        if (p != 4)
        {
            x_y = pow(abs(x - y), p);
            D[p] = pow(x_y.sum(), 1.0 / p);
        }
        else if (p == 4) //p=∞の時,
        {
            x_y = abs(x - y);
            D[4] = x_y.max();
        }
    }

    rep(i,4)
    {
        cout << std::fixed << std::setprecision(10);
        cout << D[i+1] << endl;
    }

    return 0;
}


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

using namespace std;

#define ll long long




void solve() {

	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s;

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e10;
using Graph = vector<vector<int>>;

signed main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  int cnt = 0;
  while( A >= B ){
    B *= 2;
    cnt++;
  }
  while( B >= C ){
    C *= 2;
    cnt++;
  }
  if( cnt <= K ) cout << "Yes" << endl;
  else cout << "No" << endl;



}


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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; ++i) cin >> S[i];
  sort(S.begin(), S.end());
  for (int i = 0; i < N; ++i) cout << S[i];
  cout << endl;
}

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

typedef long long ll;
typedef pair<int, int> ii;
vector<ii> vp;

bool compare(ii A, ii B)
{
    return A.second < B.second;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, a, b;

    cin>>n;

    bool flag = true;
    for(int i = 0; i < n; i++){
        cin>>a>>b;
        if(a > b)
            flag = false;
        vp.push_back(make_pair(a, b));
    }

    if(!flag){
        cout<<"No"<<endl;
        return 0;
    }
    sort(vp.begin(), vp.end(), compare);

    ll t = 0;
    for(int i  = 0; i < vp.size(); i++){
        //cout<<vp[i].first<<" "<<vp[i].second<<endl;
        t += (ll) vp[i].first;
        if(t > vp[i].second){
            flag = false;
        }
    }

    if(!flag){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }

    return  0;
}



Measured memory_bytes: 2420
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han Elmuzaffer Daima
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 3000005; 
const lo mod = 1000000007; 

lo n,m,cev,b,a[li],k,z,fac[li+105],fac_v[li+100];
string s;
vector<int> v;

inline lo mul(lo x,lo y){
	return (x%mod)*(y%mod)%mod;
}

inline lo add(lo x,lo y){
	if(x+y>=mod) return x+y-mod;
	return x+y;
}

inline lo fp(lo at,lo bt){
	if(bt==0) return 1;
	if(bt==1) return at;
	lo t=fp(at,bt/2);
	t=mul(t,t);
	if(bt%2==1) t=mul(t,at);
	return t%mod;
}

inline lo com(lo s1,lo s2){
	lo x=mul(fac_v[s2],fac_v[s1-s2]);
	return mul(x,fac[s1]);
}

inline lo solve(){
	scanf("%lld %lld %lld %lld",&n,&m,&k,&z);
	fac[0]=1;
	//~ fa[1]=1;
	for(lo i=1;i<=n+m+1;i++) fac[i]=mul(fac[i-1],i);
	
	//~ fac_v[0]=1;
	for(lo i=0;i<=n+m+1;i++){fac_v[i]=fp(fac[i],mod-2);}
	//~ cout<<"**\n";
	for(lo i=z+1;i<=m;i++){
		cev=add(cev,mul(com(n-k+i-2,n-k-1),com(k+m-i-1,k-1)));
	}
	printf("%lld\n",cev);
	return 0;
}

int main(void){
	solve();
	
	return 0;
}


Measured memory_bytes: 7936
local read = io.read

local D = read("*n")
local c = {}
for i = 1, 26 do
	c[i] = read("*n")
end
local s = {}
for i = 1, D do
	s[i] = {}
	for j = 1, 26 do
		s[i][j] = read("*n")
	end
end

local function MaxIndexAndVar(list)
	local maxIndex, maxVar = -1, -1
	for i = 1, #list do
		if list[i] > maxVar then
			maxIndex, maxVar = i, list[i]
		end
	end
	return maxIndex, maxVar
end

for i = 1, D do
	local t = MaxIndexAndVar(s[i])
	print(t)
end


Measured memory_bytes: 2732