akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
class Program
{
    public static int[] w;
    public static int n;
    public static int k;
    public static bool Ok(int p)
    {
        int wn = 0, tn = 1;
        for (int i = 0; i < n; i++)
        {
            if (wn + w[i] <= p)
            {
                wn += w[i];
                continue;
            }
            else
            {
                tn++;
                wn = w[i];
            }
        }
        return tn <= k;
    }
    static void Main()
    {
        //入力の受け取り
        string[] s = Console.ReadLine().Split(' ');
        n = int.Parse(s[0]);
        k = int.Parse(s[1]);
        w = new int[n];
        for (int i = 0; i < n; i++)
            w[i] = int.Parse(Console.ReadLine());

        //処理内容
        int l = w.Max(), h = w.Sum();
        while (l < h)
        {
            int m = (l + h) / 2;
            if (Ok(m))
                h = m;
            else
                l = m + 1;
        }

        //解答の出力
        Console.WriteLine(h);
    }
}


Measured memory_bytes: 10176
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
    ios::sync_with_stdio(false);
    char a;
    double x=0,y=0,num,deg1,deg=90;
    while(cin>>num>>a>>deg1,num||deg1){
        x+=(cos(deg*M_PI/180)*num);
        y+=(sin(deg*M_PI/180)*num);
                deg-=deg1;
    }
    cout << (int)x << "\n" << (int)y << "\n";
    return 0;
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

signed main()
{
    int n;
    int a[100000];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    vector<int> vtor;
    vector<int> vtol;

    vtor.push_back(0);
    vtor.push_back(a[0]);
    vtol.push_back(0);
    vtol.push_back(a[n - 1]);

    int prev = a[0];
    for (int i = 1; i < n; i++)
    {
        prev = euclid(prev, a[i]);
        vtor.push_back(prev);
    }

    prev = a[n - 1];
    for (int i = n - 2; i >= 0; i--)
    {
        prev = euclid(prev, a[i]);
        vtol.push_back(prev);
    }

    int max = -1;
    /*
    for (int i = 0; i < vtor.size(); i++)
        cout << vtor[i] << " ";
    cout << endl;
    for (int i = 0; i < vtol.size(); i++)
        cout << vtol[i] << " ";
    cout << endl;
*/
    for (int i = 0; i < n; i++)
    {
        // cout << vtor[i] << "," << vtol[vtol.size() - (i + 1) - 1] << endl;
        int tmp = euclid(vtor[i], vtol[vtol.size() - (i + 1) - 1]);
        if (tmp > max)
            max = tmp;
    }
    cout << max << endl;
}


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class E
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int K = GetInt();
		int Q = GetInt();
		int[] A = GetInts(N);

		int ans = int.MaxValue;
		for(int i = 0; i < N; i++)
		{
			var removable = new List<int>();
			var tmp = new List<int>();
			for(int j = 0; j < N; j++)
			{
				if(A[j] >= A[i])
				{
					tmp.Add(A[j]);
				}
				else
				{
					addRemovable(K, removable, tmp);
					tmp = new List<int>();
				}
			}
			addRemovable(K, removable, tmp);

			if(removable.Count < Q)
				continue;

			removable.Sort();
			chmin(ref ans, removable[Q - 1] - A[i]);
		}

		WriteLine(ans);
	}

	private void addRemovable(int K, List<int> removable, List<int> tmp)
	{
		tmp.Sort();
		removable.AddRange(tmp.GetRange(0, Max(0, tmp.Count - K + 1)));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 40768
N=input()
S1=raw_input()
S2=raw_input()

mod=1000000007

str=""
i=0
while i<N:
	if S1[i]==S2[i]:
		str+="t"
		i+=1
	else:
		str+="y"
		i+=2


l=len(str)

ans=1
if str[0]=="t": ans*=3
else: ans*=6

for i in range(l-1):
	now=str[i]
	next=str[i+1]
	if now=="t" and next=="y":
		ans*=2
	elif now=="t" and next=="t":
		ans*=2
	elif  now=="y" and next=="y":
		ans*=3
	elif  now=="y" and next=="t":
		ans*=1
	ans%=mod

print ans


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return ;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e6+3;
const int INF = 1e9;

void solve() {
    int n; cin >> n;
    map<string,int> m;
    fori(i,n) {
        string s; cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << '\n';
    cout << "WA x " << m["WA"] << '\n';
    cout << "TLE x " << m["TLE"] << '\n';
    cout << "RE x " << m["RE"] << '\n';
} 

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1;
    //cin >> ntest;
    fori(test, ntest) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>

using namespace std;

#define vec vector
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int cal(char a, int d1, int d2)
{
	if (a == '*') {
		return min(d1, d2);
	} else {
		return max(d1, d2);
	}
}

int ret(int a, int minus)
{
	if (minus % 2) return 2 - a;
	else return a;
}

int solve(vec<char> formula, int p, int q, int r)
{
	stack<int> ans;
	int minus = 0;
	rep(i, formula.size()) {
		char get = formula[i];
		if (get == '0' || get == '1' || get == '2'){
		   	ans.push((int)get - '0');
		}
		else if (get == 'P') ans.push(p);
		else if (get == 'Q') ans.push(q);
		else if (get == 'R') ans.push(r);
		else if (get == '-') {
			int a = ans.top();
			ans.pop();
			ans.push(2 - a);
		} else {
			int d1, d2;
			d1 = ans.top();
			ans.pop();
			d2 = ans.top();
			ans.pop();
			ans.push(ret(cal(get, d1, d2), minus));
		}
		if (get != '-') minus = 0;
	}
	if (ans.top() == 2) return 1;
	else return 0;
}

int main(void)
{
	while(1) {
		string s;
		cin >> s;
		if (s == ".") break;

		stack<char> keep;
		vec<char> formula;
		rep(i, s.length()) {
			if (s[i] == '-' || s[i] == '+' || s[i] == '(' || s[i] == '*') keep.push(s[i]);
			else if (s[i] == ')') {
				while(1) {
					char get = keep.top();
					keep.pop();
					if (get == '(') break;
					formula.push_back(get);
				}
				while(!keep.empty() && keep.top() == '-') {
					keep.pop();
					formula.push_back('-');
				}
			} else {
				formula.push_back(s[i]);
				while(!keep.empty() && keep.top() == '-') {
					keep.pop();
					formula.push_back('-');
				}
			}
		}
		int num = 0;
		rep(p, 3) rep(q, 3) rep(r, 3) num += solve(formula, p, q, r); 
		cout << num << endl;
	}
	return 0;
}

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

int main() {
  int A;
  cin >> A;
  
  char op;
  cin >> op;
  
  int B;
  cin >> B;
  
  if(op == '+') {
    cout << A + B << endl;
  }
  else if(op == '-') {
    cout << A - B << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  char b;
  cin >> b;
  if(b=='A'){
    print('T');
  }
  else if(b=='T'){
    print('A');
  }
  else if(b=='G'){
    print('C');
  }
  else{
    print('G');
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char s[105];

int main() {

	scanf("%s",s);

	int i;

	int len = strlen(s);

	int flag = 0;
	int ans = 0;

	for (i = 0; i < len; i++) {
		if (s[i] == 'C') { flag = 1; }
		if (flag == 1 && s[i] == 'F') { ans = 1; }
	}
	if (ans == 0) { printf("No\n"); }
	else { printf("Yes\n"); }

	return 0;
}

Measured memory_bytes: 128
S = input()

def nextsun(s):
  if s == "SUN":
    return 7
  if s == "MON":
    return 6
  if s == "TUE":
    return 5
  if s == "WED":
    return 4
  if s == "THU":
    return 3
  if s == "FRI":
    return 2
  if s == "SAT":
    return 1
    
print(nextsun(S))
      

Measured memory_bytes: 2940
using System;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int[,] A = new int [n, m];
            int[] B = new int [m];
            for (int y = 0; y < n; y++)
            {
                String[] a = Console.ReadLine().Split(' ');
                for (int x = 0; x < m; x++)
                {
                    int an = int.Parse(a[x]);
                    A[y, x] = an;
                }
            }
            for (int x = 0; x < m; x++)
            {
                String b = Console.ReadLine();
                int bn = int.Parse(b);
                B[x] = bn;
            }
            for (int y = 0; y < n; y++)
            {
                int Sum = 0;
                for (int x = 0; x < m; x++)
                {
                    int sum =( A[y, x] * B[x]);
                    Sum = Sum + sum;
                }
                Console.WriteLine(Sum);
            }
        }
    }
}

Measured memory_bytes: 9248
using System;

namespace ABC072B
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            string res = String.Empty;

            for (int i = 0; i < s.Length; i += 2)
            {
                res += s[i];
            }

            Console.WriteLine(res);
        }
    }
}


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

using namespace std;
using ll = long long;

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

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

  int r = 0;
  rep(i, n) r += (s[i] == 'R');
  string t;
  rep(i, n) {
    if (i < r)
      t += 'R';
    else
      t += 'W';
  }

  int ans = 0;
  rep(i, n) if (s[i] != t[i])++ ans;
  cout << ans / 2 << endl;

  return 0;
}


Measured memory_bytes: 3916
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n,k;
    cin >> n >> k;
    int a,b;
    vector<set<int>> edge;
    rep(i,n+2){
        edge.push_back({});
    }
    rep(i,n-1){
        cin >> a >> b;
        edge[a].insert(b);
        edge[b].insert(a);
    }
    long long ans = 1;
    stack<int> s;
    s.push(1);
    int point[n+1];
    rep(i,n+1){
        point[i]=0;
    }
    while(!s.empty()){
        int now = s.top();
        if(edge[now].empty()){
            s.pop();
            if(s.empty()) break;
            point[s.top()]++;
        }
        else{
            auto itr = edge[now].begin();
            int next = *itr;
            edge[now].erase(next);
            edge[next].erase(now);
            ans*=max(0,(k-point[now]-1));
            ans%=MOD;
            point[next]++;
            s.push(next);
        }
    }
    ans*=k;
    ans%=MOD;
    cout << ans << endl;
}

Measured memory_bytes: 16236
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);

    for (auto &e: h) {
        cin >> e;
    }

    sort(h.begin(), h.end());

    int ans = 1e9;

    for (int i = 0; i+K-1 < N; ++i) {
        ans = min(ans, h[i+K-1] - h[i]);
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  string words[4] = {"dream", "dreamer", "erase", "eraser"};
  for(int i = 0; i < 4; i++) reverse(words[i].begin(), words[i].end());
  string s; cin >> s;
  reverse(s.begin(), s.end());

  bool flag;
  for(int i = 0; i < s.size(); ) {
    flag = false;
    for(int j = 0; j < 4; j++) {
      if(s.substr(i, words[j].size()) == words[j]) {
        i += words[j].size();
        flag = true;
      }
    }
    if(!flag) break;
  }
  cout << (flag ? "YES" : "NO") << endl;
}


Measured memory_bytes: 512
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;

        if(a>b){
            count = a;
            a--;
        }else{
            count = b;
            b--;
        }

        if(a>b){
            count += a;
        }else{
            count += b;
        }

        System.out.println(count);
    }
}

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

int main(){
    int N;
    cin >> N;
    int V[20];
    int C[20];
    int kai = 0;
    int Y = 0;
    for(int i=0;i<N;i++){
        cin >> V[i];
    }
    for(int i=0;i<N;i++){
    cin >> C[i];
    }
    for(int i=0;i<N;i++){
        if(V[i] > C[i]){
            kai += V[i];
            Y += C[i];
        }
    }
    cout << kai - Y << endl;
}

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

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

	vector<int> a;

	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;

		if (i == 0) {
			a.push_back(b);
		}
		else if (i > 0 && a[a.size() - 1] != b) {
			a.push_back(b);
		}
	}

	cout << a[0];

	for (int i = 1; i < a.size(); i++) {
		cout << " " << a[i];
	}

	cout << endl;

	return 0;
}


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

int main() {
    int n, m, p; cin >> n >> m >> p;
    vector<int> d(m);
    for(int i = 0; i < m; ++i) {
        cin >> d[i];
        d[i] = (n - p + d[i]) % n;
    }
    sort(begin(d), end(d));

    int ans = min(d.back(), n - d[0]);
    for(int i = 0; i < m - 1; ++i) {
        ans = min(ans, min(2 * d[i] + (n - d[i + 1]), 2 * (n - d[i + 1]) + d[i]));
    }
    cout << ans * 100 << endl;
}



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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,count = 0;
	string s;
	cin >> n;
	cin >> s;
	for(int i = 0;i < n;i++){
		if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
			count++;
		}
	}
	cout << count;
	return 0;
}


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

int main(){
  int D, N;
  cin >> D  >> N;
  
  if(D == 0){
    if(N == 100){
      cout << 101 << endl;
    }
    else{
    cout << N << endl;
    }
  }
  if(D == 1){
    if(N == 100){
      cout << 10100 << endl;
    }
    else{
    cout << N * 100 << endl;
    }
  }
  if(D == 2){
    if(N == 100){
      cout << 1010000 << endl;
    }
    else{
    cout << N * 10000 << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#define ll long long
using namespace std;
int main() {
    ll n;
    cin>>n;
    ll W;
    cin>>W;
    ll w[n];
    ll v[n];
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=W;j++){
            dp[i][j]=0;
        }
    }

    for(int i=0;i<=n;i++){
        for(int j=0;j<=W;j++){
            if(i==0||j==0){
                dp[i][j]=0;
            }
            else if(w[i-1]<=j){
                dp[i][j]=max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
        
    }
    cout<<dp[n][W]<<endl;
}


Measured memory_bytes: 79104
/**/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n;cin>>n;
	string s,t;cin>>s>>t;
	for (int i = 0; i < 2*n; ++i)
	{
		ll z=i/2;
		if(i%2==0)cout<<s[z];
		else cout<<t[z];
	}
}

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

int num[3];

int main() {
	for (int i = 0; i < 3;i++) {
		cin >> num[i];
	}
	sort(num,num+3);

	
	

	if (num[2] == num[0]+num[1]) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    a, b = [int(i) for i in input().strip().split()]
    towers = [0] * 1000
    dif = b - a
    for i in range(1, 1000):
        towers[i] = i + towers[i - 1]
    for i in range(1, 999):
        if towers[i + 1] - towers[i] == dif:
            ans = towers[i + 1] - b
            print(ans)
            break
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 62080
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Point {
public:
	long double px, py;
	Point() : px(0), py(0) {};
	Point(long double px_, long double py_) : px(px_), py(py_) {};
	bool operator==(const Point& p) const { return px == p.px && py == p.py; }
	bool operator!=(const Point& p) const { return px != p.px || py != p.py; }
	bool operator<(const Point& p) const { return px < p.px ? true : (px == p.px && py < p.py); }
	bool operator>(const Point& p) const { return px > p.px ? true : (px == p.px && py > p.py); }
	bool operator<=(const Point& p) const { return !(Point(px, py) > p); }
	bool operator>=(const Point& p) const { return !(Point(px, py) < p); }
	Point operator+(const Point& p) const { return Point(px + p.px, py + p.py); }
	Point operator-(const Point& p) const { return Point(px - p.px, py - p.py); }
	Point operator/(long double d) const { return Point(px / d, py / d); }
	friend Point operator*(const Point p, long double d) { return Point(p.px * d, p.py * d); }
	friend Point operator*(long double d, const Point& p) { return p * d; }
	Point& operator+=(const Point& p1) { px += p1.px, py += p1.py; return *this; }
	Point& operator-=(const Point& p1) { px -= p1.px, py -= p1.py; return *this; }
	Point& operator*=(long double d) { px *= d, py *= d; return *this; }
	Point& operator/=(long double d) { px /= d, py /= d; return *this; }
};
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int contain(vector<Point> v, Point p) {
	bool in = false;
	for (int i = 0; i < v.size(); ++i) {
		Point a = v[i] - p, b = v[(i + 1) % v.size()] - p;
		if (a.py > b.py) swap(a, b);
		if (a.py <= 0 && 0 < b.py)
			if (crs(a, b) < 0) in = !in;
		if (crs(a, b) == 0 && dot(a, b) <= 0) return 1;
	}
	return in ? 2 : 0;
}
int n; Point a, b;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		vector<Point> v(3);
		for (int j = 0; j < 3; j++) cin >> v[j].px >> v[j].py;
		cin >> a.px >> a.py >> b.px >> b.py;
		if (contain(v, a) != contain(v, b)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
n = int(input())
a = list(map(int, input().split()))
sum_a, sum_b = 0, 0

for i in range(n):
    sum_a += max(a)
    a[a.index(max(a))] = 0
    sum_b += max(a)
    a[a.index(max(a))] = 0

print(sum_a - sum_b)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define Yes(i) cout<<(i%2?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
struct poi{
	int X;int Y;int Z;
	bool operator<(const poi&R)const{
		return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
	}
};
//
ll GCD(ll a,ll b){
	return (b==0)?(a):(GCD(b,a%b));
}
ll LCM(ll a,ll b){
	return a/GCD(a,b)*b;
}
//
ll a[100000],c[100000];
ll l[100000],r[100000];
ll cul[100000];
int main(){
	string S;
	cin>>S;
	int cc=0;
	FOR(i,0,S.size()){
		if(S[i]=='A'){
			a[i]++;
		}else if(S[i]=='C'){
			c[i]++;
		}else if(S[i]=='?'){
			l[i]++;r[i]++;
			cc++;
		}
	}
	FOR(i,1,S.size()){
		(a[i]+=a[i-1])%=mod;
		(l[i]+=l[i-1])%=mod;
	}
	ROF(i,0,S.size()-1){
		(c[i]+=c[i+1])%=mod;
		(r[i]+=r[i+1])%=mod;
	}
	ll aa=1;
	FOR(i,0,cc+1){
		(cul[i]=aa)%=mod;
		(aa*=3)%=mod;
	}
	ll ans=0;
	FOR(i,1,S.size()-1){
		if(S[i]=='B'){
			(ans+=a[i-1]*c[i+1]*cul[cc])%=mod;
			if(cc>0){
				(ans+=a[i-1]*r[i+1]*cul[cc-1])%=mod;
				(ans+=l[i-1]*c[i+1]*cul[cc-1])%=mod;
			}
			if(cc>1){
				(ans+=l[i-1]*r[i+1]*cul[cc-2])%=mod;
			}
		}else if(S[i]=='?'){
			(ans+=a[i-1]*c[i+1]*cul[cc-1])%=mod;
			if(cc>1){
				(ans+=a[i-1]*r[i+1]*cul[cc-2])%=mod;
				(ans+=l[i-1]*c[i+1]*cul[cc-2])%=mod;
			}
			if(cc>2){
				(ans+=l[i-1]*r[i+1]*cul[cc-3])%=mod;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4352
fun main(args: Array<String>) {
    val list = readLine()!!.split(" ").map(String::toInt)
    var t = list[0]
    val h = (t/3600).toInt()
    t = t - (h * 3600)
    val m = (t/60).toInt()
    t = t - (m * 60)

    println("%d:%d:%d".format(h,m,t))
}


Measured memory_bytes: 33856
#include <stdlib.h>
#include <iostream>
#include <cmath>

int main()
{
	int a,b,k,i,s=0;
	std::cin>>k;
	std::cin>>a>>b;
	for(i=a;i<=b;i++)
    {
      if(i%k==0)
      s++;
    }
    if(s==0)
	std::cout<<"NG";
	else
	std::cout<<"OK";
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int main() {
	vector<int> a(3); cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	int ans = 0;
	ans += a[2] - a[1];
	a[0] += a[2] - a[1];
	ans += (a[2] - a[0] + 1)/2 + (a[2] - a[0])%2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
const int N =1e7+6;
const int mod = 1e9+7;
ll p[N];
void solve(){
    int n;
    cin>>n;
    ll ans = 0;
    for(ll i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            p[j]++;
        }
        ans+=i*p[i];
    }
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t = 1;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 81724
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int[][]dp;
	boolean[][]Map;//true なら 通行可能 false は 通行不可
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		int h = nextInt();
		int w = nextInt();
		Map=new boolean[h][w];
		dp=new int[h+1][w+1];
		int Mod = 1000_000_007;

		for(int i=0;i<h;i++) {
			char C[] = next().toCharArray();
			for(int j=0;j<w;j++)if(C[j]=='.')Map[i][j]=true;
		}

		dp[h-1][w-1]=1;//目的地
		//右端
		for(int i = h-2;0<=i;i--) {
			if(!Map[i][w-1])break;
			dp[i][w-1]=1;
		}
		//下端
		for(int i = w-2;0<=i;i--) {
			if(!Map[h-1][i])break;
			dp[h-1][i]=1;
		}
		//dp[0][0]~dp[h-2][w-2]の範囲
		for(int i=h-2;0<=i;i--) {
			for(int j=w-2;0<=j;j--) {
				if(Map[i][j])dp[i][j]=dp[i+1][j]+dp[i][j+1];
				if(dp[i][j]>=Mod)dp[i][j]-=Mod;
			}
		}

		System.out.println(dp[0][0]);
	}
	private int nextInt() {
		return Integer.parseInt(sc.next());
	}
	private String next() {
		return sc.next();
	}
}

Measured memory_bytes: 37844
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n;
unsigned long long num[N];
char ss[20];
inline bool cmp ( char x , char y ) {
	return (int)x<(int)y;
}
inline bool cmp2( unsigned long long x , unsigned long long y ){
	return x<y;
}
int main ( void ) {
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf ( "%s" , ss + 1 );
		int len = strlen ( ss + 1 );
		
		sort ( ss + 1 , ss + 1 + len , cmp );	
		for(int j=1;j<=len;j++) {
			num[i]=num[i]*233+(int)ss[j];
		//	cout<<ss[j];
		}
	}
	sort(num+1,num+1+n,cmp2);
	long long ans=0,tp=1;
	unsigned long long xx=num[1];
	
//	for(int i=1;i<=n;i++)
//		cout<<num[i]<<endl;
	
	for(int i=2;i<=n+1;i++){
		if(xx==num[i]){
			tp++;
			continue;
		}
		else {
			ans+=(tp)*(tp-1)/2;
			tp=1;
			xx=num[i];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int n, C;
	scanf("%d %d", &n, &C);
	int i, j;
	int s, t, c;
	int d[33][200005];
	for (i = 0; i < 33; i++)
		for (j = 0; j < 200005; j++)
			d[i][j] = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d %d %d", &s, &t, &c);
		d[c - 1][2 * s - 1]++;
		d[c - 1][2 * t]--;
	}
	for (i = 0; i < C; i++)
		for (j = 1; j < 200005; j++)
			d[i][j] += d[i][j - 1];
	int ans = 0;
	for (i = 0; i < 200005; i++)
	{
		c = 0;
		for (j = 0; j < C; j++)
			if (d[j][i] > 0)
				c++;
		if (ans < c)
			ans = c;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    double best=((double)t-(double)a)*500.0/3.0;
    double min=10000000.0;
    int ans;
    rp(i,n){
        double a;
        cin >> a;
        if(min>best-a&&min>a-best){
            ans=i+1;
            min=best-a;
            if(min<0.0) min= -min;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    ll T[110];
    cin >> N;
    rep(i,0,N){
        cin >> T[i];
    }
    ll ans = T[0];
    rep(i,1,N){
        ans /= gcd(ans, T[i]);
        ans *= T[i];
    }
    print(ans);

}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int M1,D1,M2,D2;
    Scd2(M1,D1);
    Scd2(M2,D2);

    printf ("%d\n", M1!=M2 );

    return 0;
}



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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a>max(b,c)){
        if(b<c)cout << b << " " << c << " " << a << endl;
        else cout << c << " " << b << " " << a << endl;
    }
    else if(b>max(a,c)){
        if(a<c)cout << a << " " << c << " " << b << endl;
        else cout << c << " " << a << " " << b << endl;
    }
    else if(b<a)cout << b << " " << a << " " << c << endl;
    else cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)
#define CK(n, a, b) (a <= n && n < b)
#define MP(a, b) make_pair(a, b)
typedef long long ll;
const ll mod =1e9+7;
const int inf =1e9;
using namespace std;


ll k;
ll num[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
    cin>>k;
    cout<<num[k-1]<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
R = []
B = []
for i in range(N):
    R.append(list(map(int, input().split())))
for i in range(N):
    B.append(list(map(int, input().split())))

R.sort(key=lambda x:x[0], reverse=True)
B.sort(key=lambda x:x[1], reverse=False)

ans = 0
for r in R:
    for b in B:
        if r[0]<b[0] and r[1]<b[1]:
            ans += 1
            B.remove(b)
            break
            
print(ans)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
ap = []; am = []
for a in A:
  if a > 0:
    ap.append(a)
  else:
    am.append(a)

if ap and am:
  print(sum(ap) - sum(am))
  ap_last = ap.pop()
  am_base = am.pop()
  while ap:
    a = ap.pop()
    print(am_base, a)
    am_base -= a
  print(ap_last, am_base)
  ap_last -= am_base
  while am:
    a = am.pop()
    print(ap_last, a)
    ap_last -= a
elif ap:
  ap.sort(reverse=True)
  ap_base = ap.pop()
  print(sum(ap) - ap_base)
  ap_last = ap.pop()
  while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
  print(ap_last, ap_base)
else:
  am.sort()
  am_base = am.pop()
  print(am_base - sum(am))
  while am:
    a = am.pop()
    print(am_base, a)
    am_base -= a

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

int A,B,K;

int main()
{
	cin >> A >> B >> K;
	int cnt = 0;
	for(int i = max(A,B); i > 0; i--){
		if(A % i == 0 && B % i == 0){
			cnt++;
			if(cnt == K){
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const double eps = 1e-8;
struct evol
{
    double x, y;
}a[N],O;
double R;
double sqr(double x) {return x * x;}
double dis(evol u,evol b) {return sqrt(sqr(u.x - b.x) + sqr(u.y - b.y));}
void work(evol p1,evol p2,evol p3)
{
    double A,b,c,d,e,f;
    A=p2.y-p1.y; 
	b=p3.y-p1.y;
	c=p2.x-p1.x;
	d=p3.x-p1.x;
    f=p3.x*p3.x+p3.y*p3.y-p1.x*p1.x-p1.y*p1.y;
    e=p2.x*p2.x+p2.y*p2.y-p1.x*p1.x-p1.y*p1.y;
    O.x=(A*f-b*e)/(2*A*d-2*b*c);
	O.y=(d*e-c*f)/(2*A*d-2*b*c);
    R = dis(O, p1);
}
int main()
{
    int n;
    scanf("%d", &n);
    for (int i=1;i<=n;++i)
		scanf("%lf%lf",&a[i].x,&a[i].y);
    random_shuffle(a+1,a+n+1);
    O = a[1]; R = 0;
    for (int i = 2; i <= n; ++i)
        if (dis(a[i], O)>R+eps) 
		{
            O=a[i];R=0;
            for (int j = 1;j<i; ++j)
                if (dis(a[j],O)>R+eps) 
				{
                    O=(evol){(a[i].x + a[j].x)/2,(a[i].y + a[j].y)/2};
					R = dis(a[j], O);
                    for(int k=1;k<j;++k)
						if(dis(a[k],O)>R+eps) 
						work(a[i], a[j], a[k]);
                }
        }
    printf("%.20lf\n", R);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(int n){
    cout << "Yes" << endl;
}

void no (int n){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int div2(ll a){
    int ans = 0;
    while (a % 2LL == 0){
        a /= 2LL;
        ans++;
    }
    return ans;
}

int div5(ll b){
    int ans = 0;
    while (b % 5LL == 0){
        b /= 5LL;
        ans++;
    }
    return ans;
}

int main() {
    int n; cin >> n;
    int ma = 0;
    vector<int> ar(n);
    rep(i,n){
        cin >> ar[i];
        ma = max(ma,ar[i]);
    }
    vector<P> ans;
    bool t = true;
    rep(i,n){
        if (t && ar[i] == ma){
            t = false;
        }
        else ans.emplace_back(P(ar[i],0));
    }
    rep(i,n-1) ans[i].second = min(ans[i].first,ma - ans[i].first);
    int mans = 0;
    int mas = 0;
    rep(i,n-1) {
        if (mas < ans[i].second){
            mas = ans[i].second;
            mans = ans[i].first;
        }
    }
    cout << ma << " " << mans << endl;
}

Measured memory_bytes: 4668
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

const int MAX = 710000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
 
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

long long PAR(int n, int k){
    if(n < k)return 0;
    if(n < 0 || k < 0)return 0;
    return fac[n] * finv[n-k] % mod;
}

int main() {
    int n, m;
    cin >> n >> m;
    if(n > m)cout << 0 << endl;
    else{
        COMinit();
        ll ans = PAR(m, n) * PAR(m, n) % mod;
        ll k = -1;
        for(int i = 1; i <= n; i++){
            ll now = k;
            now = now * COM(n, i) % mod;
            now = now * PAR(m, i) % mod;
            now = now * PAR(m-i, n-i) % mod;
            now = now * PAR(m-i, n-i) % mod;
            ans = (ans + now + mod) % mod;
            k *= -1;
        }
        cout << ans << endl;
    }
}

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

int main(){
  int n;
  cin >> n;
  map<int,int> mp1,mp2;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if(i%2){
      mp1[a]++;
    } else {
      mp2[a]++;
    }
  }
  vector <pair<int,int>> a,b;
  for(auto it:mp1){
    a.emplace_back(it.second,it.first);
  }
  for(auto it:mp2){
    b.emplace_back(it.second,it.first);
  }
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  if(a[0].second!=b[0].second){
    cout << n-a[0].first-b[0].first << endl;
  } else {
    cout << n-max(a[0].first+b[1].first,a[1].first+b[0].first) << endl;
  }
  return 0;
}


Measured memory_bytes: 6136
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



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


int  n;
string s;
cin>>n;
cin>>s;
int cnt=0;
for(int i=0;i<s.size();i++)
{
	if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
	{
		cnt++;
	}
}

cout<<cnt<<"\n";


	
	
	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}

Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
//template<typename T>void pp(T x){cout<<x<<endl;}

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=0;i<1000000;i++){
        if(a%2==1||b%2==1||c%2==1){
            cout<<i<<endl;
            return 0;
        }
        int ha=a/2,hb=b/2,hc=c/2;
        a=hb+hc;
        b=ha+hc;
        c=ha+hb;
    }
    cout<<-1<<endl;
    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

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

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

  int a, b, m;
  cin >> a >> b >> m;
  vector<int> xs(a);
  vector<int> ys(b);
  for (int i = 0; i < a; i++) {
    cin >> xs[i];
  }
  for (int i = 0; i < b; i++) {
    cin >> ys[i];
  }

  int r = 1E9;
  for (int i = 0; i < m; i++) {
    int xi, yi, c;
    cin >> xi >> yi >> c;
    xi--;
    yi--;
    UpdateMin(r, xs[xi] + ys[yi] - c);
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  UpdateMin(r, xs[0] + ys[0]);
  cout << r << endl;
}

Measured memory_bytes: 1024
H, W, A, B = map(int ,input().split())

ans = []
b = 0

for _ in range(H):
    if b < B:
        ans.append(''.join(map(str, [1] * A + [0] * (W - A))))
        b += 1
    else:
        ans.append(''.join(map(str, [0] * A + [1] * (W - A))))

print(*ans, sep='\n')

Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L
const int mxN = 1e9 + 7;

char s[100005];
long long dp[100005][13];

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector<int> b = a;
    sort(b.rbegin(), b.rend());
    for (int i = 0; i < n; i++) {
        if (b[0] == a[i]) cout << b[1] << "\n";
        else cout << b[0] << "\n";
    }
    return 0;
}

Measured memory_bytes: 4836
# Coding-utf

S=list(map(str, input()))
lenth=0
max=0
for i in range(len(S)):
    if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            lenth+=1
    else:
        if max<lenth:
            max=lenth
            lenth=0
        else:
            lenth=0

if max<lenth:
    max=lenth

print(max)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <cctype>
#include <ctype.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int cou = 0;
    int ans = 0;
    int j = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    
        if (a[i] == cou + 1)
        {
            cou = a[i];
            ans++;
        }
        else {
          j++;
        }
    }
  if(j!=n)
  {
    cout << n - ans << endl;
  }
  else
  {
    cout << "-1" << endl;
  }

    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>

int main()
{
    char ch[200001];
    scanf("%s", ch);
    int l, i;
    l=strlen(ch);
    for (i=0; i<l; i++) {
        if (ch[i]=='?') {
            ch[i]='D';
        }
    }
    printf("%s\n", ch);
    return 0;
}


Measured memory_bytes: 1860
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<double> vd;
typedef vector<vector<double> > vvd;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) {
        s << vv[i] << endl;
    }
    return s;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep (i, n) { cin >> a[i]; }
    vvi b(n, vi(2));
    rep (i, n) {
        b[i][0] = a[i];
        b[i][1] = i;
    }
    sort(all(b));
    rep (i, n) {
        a[b[i][1]] = i;
    }
    int ans = 0;
    rep (j, (n+1)/2) {
        if ( a[j*2] % 2 == 1 ) {
            ans += 1;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 6144
import collections
import math


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n = int(input())
ai = list(map(int, input().split()))

s = [0]
for i in range(n):
    s.append(s[i] + ai[i])

c = collections.Counter(s)
print(sum([comb(v, 2) if v > 1 else 0 for v in c.values()]))

Measured memory_bytes: 41692
#include<stdio.h>
int main(void)
{
	int x,c1,c5,c10,c50,c100,c500;
	scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
	x=c1*1+c5*5+c10*10+c50*50+c100*100+c500*500;
	if(x>=1000){
		printf("1\n");
	}
	else {
		printf("0\n");
	}
	return 0;
}	

Measured memory_bytes: 1012
#include <stdio.h>
#include <stdlib.h>

int main(){
  int n,k,i,j,tmp,tmp_max,index_max=0,flag=0;
  int *a;
  double result=0.0;
  
  scanf("%d %d",&n,&k);
  a=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  tmp=0;
  for(i=0;i<(n-k+1);i++){
    tmp+=a[i];
    tmp_max=tmp;
  }
  //printf("%d\n",tmp_max);
  for(i=1;i<=n-k;i++){  
    tmp-=a[i-1];
    tmp+=a[i+k-1];
    
   // printf("%d ",tmp);
    if(tmp_max<tmp){
      index_max=i;
      tmp_max=tmp;
    }
    //printf("%d\n",index_max);
  }
  
  for(i=index_max;i<index_max+k;i++){
    result+=a[i]*(a[i]+1)/2.0/a[i];
  }
  
  printf("%f",result);
  free(a);
}
  

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

int max(int a,int b){return (a>b)?a:b;}

int main(){
  int n,m,v[110],num[110];

  while(scanf("%d%d",&n,&m),n+m){
    for(int i=0;i<=100;i++)num[i] = 0;
    int h = 0, w = 0;
    for(int i=0;i<n;i++){
      scanf("%d",&v[i]);
      num[v[i]/m]++;
      h = max(h,num[v[i]/m]);
      w = max(w,v[i]/m);
    }
    
    double res = 0.01;
    for(int i=0;i<=w;i++){
      res += (double)num[i]/h * (1.0-(double)i/w);
    }
    printf("%.9lf\n",res);
  }
}

Measured memory_bytes: 1068
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>
#include <numeric>
#include <math.h>

#define LOP(N) for(int i=0; i<N; i++)
#define LOOP(i, N) for(int i=0; i<N; i++)
#define LOOP_s(i, start, end) for(int i=start; i<end; i++)

typedef long long ll;

using namespace std;


int main() {
    string S; cin >> S;
    int N = S.length();
    vector<int> digits(N);
    LOOP(i, N) digits[i] = S[i] - '0';

    int loop_end = 1 << (N-1);
    ll sum=0, term, filter;
    LOOP(i, loop_end) {
        term = digits[0];
        LOOP_s(j, 1, N) {
            filter = 1 << (j-1);
            if ((i & filter) != 0) {
                sum += term;
                term = digits[j];
            }
            else {
                term = 10 * term + digits[j];
            }
        }
        sum += term;
    }
    
    cout << sum;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void){
    int h,m,s,x;
    int i,j;
    scanf("%d",&x);
    
    h = x / 3600;

    x = x - (h * 3600);

    m = x / 60;

    s = x - (m * 60);

    printf("%d:%d:%d\n",h,m,s);


    return 0;
}


Measured memory_bytes: 2728