akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int GCD(long long int a, long long int b){
    if(a < b) swap(a,b);
    if(b == 0) return a;
    else return GCD(b,a%b);
}
int LCM(int gcd, long long int a, long long int b) {
    return a * b / gcd;
}

int main(){
    int gcd,lcm;
    long long int a,b;
    while(1){
        cin >> a >> b;
        if(cin.eof()) break;
        gcd = GCD(a,b);
        lcm = LCM(gcd,a,b);
        cout << gcd << " " << lcm << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
package main

import (
	"fmt"
	"sort"
)

var A, B, C int

func main() {
	fmt.Scanf("%d %d %d", &A, &B, &C)

	N := []int{A, B, C}

	sort.Ints(N)

	ans := (N[2] - N[0]) / 2
	ans += (N[2] - N[1]) / 2

	if (N[2]-N[0])%2 != 0 && (N[2]-N[1])%2 != 0 {
		ans++
	} else if (N[2]-N[0])%2 != 0 || (N[2]-N[1])%2 != 0 {
		ans += 2
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){


int n;
cin>>n;
if(n<1000){
    cout<<1000-n<<endl;
}
else if(n%1000 == 0)
{
    cout<<0<<endl;
}
else
{
    int a = n/1000;
    a++;
    cout<<(a*1000)-n<<endl;
}

return 0;
}


Measured memory_bytes: 3584
import random

class Dice:
    def __init__(self):
        self.u=1
        self.w=2
        self.s=3
        self.e=4
        self.n=5
        self.d=6
        self.dic={"W":0,"S":1,"E":2,"N":3}
    
    def __init__(self,u,w,s,e,n,d):
        self.u=u
        self.w=w
        self.s=s
        self.e=e
        self.n=n
        self.d=d
        self.dic={"W":0,"S":1,"E":2,"N":3}

    def rot(self,way):
        if isinstance(way,str):
            way=self.dic[way]

        if way==0:
            c=self.u
            self.u=self.e
            self.e=self.d
            self.d=self.w
            self.w=c
        elif way==1:
            c=self.u
            self.u=self.n
            self.n=self.d
            self.d=self.s
            self.s=c
        elif way==2:
            c=self.u
            self.u=self.w
            self.w=self.d
            self.d=self.e
            self.e=c
        else :
            c=self.u
            self.u=self.s
            self.s=self.d
            self.d=self.n
            self.n=c

flag=0
lst=["W","S","E","N"]
u,s,e,w,n,d=map(int,input().split())
dice_1=Dice(u,w,s,e,n,d)
u,s,e,w,n,d=map(int,input().split())
dice_2=Dice(u,w,s,e,n,d)
for i in range(1000):
    if dice_1.u==dice_2.u and dice_1.w==dice_2.w and dice_1.s==dice_2.s and dice_1.e==dice_2.e and dice_1.n==dice_2.n and dice_1.d==dice_2.d:
        flag=1
    dice_1.rot(random.choice(lst))
if flag==1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 8188
import java.util.Scanner;

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

		int n = sc.nextInt();
		long pow = 1;
		for (int i = 1; i <= n; i++) {
			pow = pow * i % 1_000_000_007;
		}
		System.out.println(pow);
		sc.close();
	}

}

Measured memory_bytes: 21844
a[2000000],i;int z(int *a,int *b){return *a-*b;}
main(n){
for(scanf("%d",&n);i<n;i++)scanf("%d",a+i);
qsort(a,n,4,z);
for(i=0;i<n;i++)printf(i<n-1?"%d ":"%d\n",a[i]);
exit(0);}

Measured memory_bytes: 16128
#include<stdio.h>
#include<string.h>
#define Max(x,y) ((x>y)?x:y)
int d[5005][5005];
int main(){
	int i,j,k,n,m,x,y,z,ans=0;
	//memset(d,0,sizeof(d));
	scanf("%d%d",&n,&m);
	while(m--){
		scanf("%d%d%d",&x,&y,&z);
		d[x][y]=Max(d[x][y],z+1);
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=i;j++){
			d[i][j]=Max(d[i][j],Max(d[i-1][j-1],d[i-1][j])-1);
			//printf("%d ",d[i][j]);
			if(d[i][j]>0)ans++;
		}
		//printf("\n");
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#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()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vector<bool>used;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap){
		edge q={to,cap,int(G[to].size())};
		G[from].push_back(q);
		q={from,0,int(G[from].size()-1)};
		G[to].push_back(q);
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		used[v]=1;
		for(int i=0;i<G[v].size();i++){
			edge &e=G[v][i];
			if(used[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int mf(int s,int t) {//from s to t
		int flow=0,f;
		while(1){
			used=vector<bool>(n,false);
			f=dfs(s,t,inf);
			if(f==0)return flow;
			flow+=f;
		}
	}
};	
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vvi a(n,vi(3));
		rep(i,n)rep(j,3)cin>>a[i][j];
		vvi b(m,vi(2));
		rep(i,m)rep(j,2)cin>>b[i][j];
		double r=0,l=1000000;
		while(l-r>EPS){
			double h=(r+l)/2;
			MF mf(n+m+2);
			int s=n+m,t=s+1;
			rep(i,n)mf.add_edge(s,i,1);
			rep(i,m)mf.add_edge(n+i,t,1);
			rep(i,n)rep(j,m){
				double r=hypot(a[i][0]-b[j][0],a[i][1]-b[j][1])/a[i][2];
				if(r<EPS+h)mf.add_edge(i,n+j,1);
			}
			int w=mf.mf(s,t);
			if(w==m)l=h;
			else r=h;
		}
		cout<<shosu(9)<<l<<endl;
	}
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x)
{
	cout << s << " = " << x << "\n";
}
template<typename T, typename... Args> void debug(string s, T x, Args... args)
{
	cout << s.substr(0, s.find(',')) << " = " << x << " | ";
	debug(s.substr(s.find(',') + 2), args...);
}
template<class T> void print_container(T &container)
{
	for (auto &t : container)
	{
		cout << t << " ";
	}
	cout << endl;
}
template<class T> void print_pair_container(T &container)
{
	for (auto &t : container)
	{
		cout << t.first << " " << t.second << endl;
	}
	cout << endl;
}
template<class T> void printArr(T &a, int n)
{
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n;

void solve()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << max({a * d, b * d, c * a, c * b}) << endl;

}

int32_t main()
{
	IOS;


	solve();

	return 0;
}



Measured memory_bytes: 3648
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

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

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	ll s = 0;
	map<int, ll> mp;
	rep(i, n)
	{
		int a; cin >> a;
		s += a;
		++mp[a];
	}
	int q; cin >> q;
	while (q--)
	{
		ll b, c; cin >> b >> c;
		s -= b * mp[b];
		s += c * mp[b];
		cout << s << endl;
		mp[c] += mp[b];
		mp[b] = 0;
	}
}

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

int main() {
  long long K; cin >> K;
  vector<long long> A(50);
  for (int i = 0; i < 50; i++) A.at(i) = i + K / 50;
  for (int i = 0; i < K % 50; i++) {
    for (int j = 0; j < 50; j++) {
      if (j == i) A.at(j) += 50;
      else A.at(j)--;
    }
  }
  cout << 50 << endl;
  for (int i = 0; i < 50; i++) {
    if (i) cout << " ";
    cout << A.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 3636
//CF template

import java.io.*;
import java.util.*;
 
public class Main{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));
      
      //begin
      int n = sc.nextInt();
      int o = sc.nextInt();
      out.println(Math.max(n + o, Math.max(n - o, n * o)));
      //end
      out.close();
   }
 
   public static PrintWriter out;
      
   public static 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: 22100
#include<iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
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; }
//forとか代入しない場合は++iでもi++でも同じ

//a,b,cと選択肢3通りだが、二日続けて同じやつ選べない制限のせいで、dpの状態にその日の選択を含める必要がある、cost配列もa,b,cまとめて入れるためにcost[][(0,1,2)]としてしまう
// 入力
int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

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

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    // 答え
    long long res = 0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}

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

using namespace std;

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x , y;
cin >> x >> y;
    int ans = 0;
    if(x == 1){
        ans += 300000;
    }
    if(x == 2){
        ans += 200000;
    }
    if(x == 3){
        ans += 100000;
    }
    if(y == 1){
        ans += 300000;
    }
    if(y == 2){
        ans += 200000;
    }
    if(y == 3){
        ans += 100000;
    }
    if(x == 1 && y == 1){
        ans += 400000;
    }
    cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
n, w = gets.chomp.split(" ").map(&:to_i)
wv = n.times.map { gets.chomp.split(" ").map(&:to_i) }
dp = Array.new(w + 1) { 0 }
n.times do |i|
  t_dp = dp.clone
  wi, vi = wv[i]
  wi.upto(w) do |j|
    t_dp[j] = dp[j - wi] + vi if dp[j] < dp[j - wi] + vi
  end
  dp = t_dp
end
puts dp[w]

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

int main() {
    long long n;
    cin >> n;
    long long m = LONG_MAX;
    for (int i = 0; i < 5; i++) {
        long long x;
        cin >> x;
        if (x < m) {
            m = x;
        }
    }
    long long flow = n / m;
    if (n % m != 0) {
        flow += 1;
    }
    flow += 4;
    cout << flow << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    //入力を受け取る
    int D, T, S;
    cin >> D >> T >> S;
 
    //高橋君の移動時間を計算する
    int dist = S * T;
 
    //Dとdistの大小関係に応じて出力をする
    if (dist >= D) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=100+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
#endif
} 
double n,d,x;
void input()
{
	scanf("%lf%lf%lf",&n,&x,&d);
}
double ans;
void work()
{
	double m=n*2;
	while(m>0)
	{
		ans+=(x*2+(m-1)*d)/2.0;
		x=((m+2)*x+d*5)/m;
		d=(m+4)*d/m;
		m-=2;
	}
	printf("%.10lf\n",ans);
}
int main()
{
	//file();
	input();
	work();
	return 0;
}


Measured memory_bytes: 256
from collections import deque

k = int(input())

lun = deque([])
for i in range(1,10):
    lun.append(i)

for i in range(k):
    x = lun.popleft()
    if x % 10 != 0:
        lun.append(10*x+(x%10)-1)
    lun.append(10*x+x%10)
    if x % 10 != 9:
        lun.append(10*x+(x%10)+1)
print(x)

Measured memory_bytes: 11908
n,k = map(int,input().split())

candies = list(map(int,input().split()))

dp = [0] * (k+1)
minimo = [1] * (k+2)

mod = 1e9 + 7

dp[0] = 1
minimo[0] = 0

for i in range(1, n + 1):
    soma = [0] * (k+2)

    for j in range(k+1):
        dp[j] = (minimo[j+1] - minimo[max(0, j - min(k,candies[i-1]))]) % mod
        soma[j+1] = (soma[j] + dp[j]) % mod

    minimo = soma

print(int(dp[k]))


Measured memory_bytes: 218392
#include <bits/stdc++.h>
using namespace std;
bool prime[10000001];
int main() {
    for(int i=3;i<3162;i++)if(!prime[i])for(int j=i*2;j<10000001;j+=i)prime[j]=1;
    int n;
    while(cin>>n,n){
        if(n%2==0)n--;
        for(;;n-=2){
            if(!prime[n]&&!prime[n-2]&&!prime[n-6]&&!prime[n-8]){
                cout<<n<<endl;
                break;
            }
        }
    }
}

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

int main(void){
    string S,T;
    cin >> S >> T;
    int count = 0;
    for(int i=0;i<3;i++){
        if(S[i] == T[i]){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  string str;
  cin >> str;
  ll ans = 0;
  ll last = 0;
  for (ll i = 0; i < static_cast<ll>(str.size()) - 1; ++i) {
    if (str[i] == 'W') {
      ++last;
      continue;
    }
    if (str[i + 1] == 'B')
      continue;
    ans += i - last + 1;
    ++last;
    str[i+1] = 'B';
  }
  cout << ans << endl;
}


Measured memory_bytes: 3736
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n,l = readInts()
lis = [input() for _ in range(n)]
lis = sorted(lis)
print(''.join(lis))


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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    int x,n;
    cin>>x>>n;
    int a[n];
    ffor(i,0,n) cin>>a[i];
    int ans=10000000, idx=-1;
    sort(a,a+n);

    ffor(i,-1000,1000)
    {
        if(bs(a,a+n,i)) continue;
        if(abs(i-x)<ans)
        {
            ans=abs(i-x);
            idx=i;
        }
    }
    cout<<idx;
    
    return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<P> p(n);
    rep(i,n) {
        cin >> p[i].first >> p[i].second;
    }
    d *= 2;
    sort(p.begin(), p.end());
    ll tot = 0;
    queue<pair<ll,ll>> q;
    ll ans = 0;
    rep(i,n) {
        ll x = p[i].first;
        ll h = p[i].second;
        while (q.size() && q.front().first < x) {
            tot -= q.front().second;
            q.pop();
        }
        h -= tot;
        if (h > 0) {
            ll num = (h+a-1)/a;
            ans += num;
            ll damage = num*a;
            tot += damage;
            q.emplace(x+d, damage);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6356
#include<bits/stdc++.h>
using namespace std;
#define EPS 1e-8
double Deg_to_Rad(double a){
  return a * M_PI / 180.0;
}

int main(){
  int m, n;
  while(cin >> m, m){
    double a = 0, b = 0;

    //半径を1として考える
    //辺が長い方がBIGでは
    int sum = 360;
    for(int i = 0; i < m - 1; i++){
      int v;
      cin >> v;
      sum -= v;
      a += sin(Deg_to_Rad(v));
    }
    a += sin(Deg_to_Rad(sum));

    cin >> n;
    sum = 360;
    for(int i = 0; i < n - 1; i++){
      int v;
      cin >> v;
      sum -= v;
      b += sin(Deg_to_Rad(v));
    }
    b += sin(Deg_to_Rad(sum));
    if(fabs(a-b) < EPS) cout << 0 << endl;
    else if(a > b) cout << 1 << endl;
    else cout << 2 << endl;
  }
}

Measured memory_bytes: 1192
package main

import (
	"fmt"
)

func main() {
	var a = make([]int, 3)
	fmt.Scanln(&a[0], &a[1], &a[2])

	if a[0] == a[1] && a[1] == a[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using i64 = int64_t;

i64 dp[3003][3003]={0};

int main(){
    int n;
    cin >> n;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }

    for(int i=1;i<=n;++i){
        for(int j=0;j<=n-i;++j){
            if((n-i)%2 == 0){
                dp[j][j+i] = max(v[j]+dp[j+1][j+i], v[j+i-1]+dp[j][j+i-1]);
            }else{
                dp[j][j+i] = min(-v[j]+dp[j+1][j+i], -v[j+i-1]+dp[j][j+i-1]);
            }
        }
    }

    cout << dp[0][n] << endl;

    return 0;
}


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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {

    int N;
    string S;
    cin >> N;
    cin >> S;

    /**
     * - すべて異なる場合 2^N-1
     * - 重複する文字が存在ー＞重複する文字列を使ってできる文字列を求める
     * -> (2^N -1 )- (重複する文字で構成される文字列)
     */


    /**
     * 重複する文字列で構成される文字列
     * abcXdefXXhijk
     * -> Xの数だけNから引いて // 2^ (N - X.length()) * (2^X.length()-1 + X)
     * 2^X.length()-1 + X
     */

    vector<int> a(26, 0);
//    vector<bool> f(26, false);
    for (int i = 0; i < N; ++i) {
        char ch = S[i];
        int n = ch - 'a';
        a[n]++;
//        if (a[n] > 0) {
//            f[i] = true;
//        }
    }

    ll ans = 1;
    ll mod = 1e9 + 7;
    for (int i = 0; i < 26; i++) {
        ans = ans * (a[i] + 1) % mod;
    }
    cout << ans - 1 << endl;
}



Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
S = list(input())

lis = []
for s in S:
    idx = ord(s)
    if idx+N>90:
        idx -= 26
    lis.append(chr(idx+N))
print(''.join(lis))

Measured memory_bytes: 66208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> Pii;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1000000000
#define rep(i,a,b) for(int i =(a);i<(b);i++)
#define first fs
#define second ss
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

template<typename T, typename U>
static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}

// call by reference is used in x
template<typename T, typename U>
static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
//////////////////////////////////////end of template//////////////////////////////////////

int main(){

 ll n;
 cin >> n;
 ll ans = (n*(n-1))/2;
 cout << ans <<endl;
 
}




Measured memory_bytes: 256
import java.util.Scanner


import scala.io.StdIn._

object Main extends App {

  val Array(n,m) = readLine().split(" ").map(_.toInt)


  def solve() = {
    f(n) + f(m)
  }
  
  def f(x: Int): Int =
    if(x >= 2) x * (x-1) / 2 else 0

  println(solve())

}



Measured memory_bytes: 54660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
 
int main(){
    string N;
    cin >> N;
    rep(i, N.length()){
        if(N[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
 
    }
    cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdint>

int main() {
  int N, P;
  scanf("%d %d", &N, &P);

  int A[2]={};
  for (int i=0; i<N; ++i) {
    int a;
    scanf("%d", &a);
    ++A[a&1];
  }

  int ncr[51][51]={};
  ncr[0][0] = 1;
  for (int i=1; i<=50; ++i) {
    ncr[i][0] = ncr[i][i] = 1;
    for (int j=1; j<i; ++j)
      ncr[i][j] = ncr[i-1][j-1] + ncr[i-1][j];
  }

  intmax_t res=0;
  for (int i=P; i<=A[1]; i+=2)
    res += ncr[A[1]][i];

  printf("%jd\n", res<<A[0]);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define maxn 200005
#define LL long long
using namespace std;
LL a[maxn],k;
LL cut[maxn];
int n;
LL L=1,R=0;
 
bool check(LL t){
	LL cnt=0;
	for(int i=1;i<=n;i++){
		cut[i]=(a[i]/t)-1+(a[i]%t>0);
		cnt+=cut[i];
	}
	if(cnt<=k)return 1;
	else return 0;
}
 
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)R=max(R,a[i]);
	R++;
	while(L+1<R){
		LL mid=L+R>>1;
	//	cout<<L<<" "<<R<<" "<<mid<<endl;
		if(check(mid))R=mid;else L=mid;
	}
	if(check(L))cout<<L<<endl;
	else cout<<R<<endl;
}

Measured memory_bytes: 6648
#include"bits/stdc++.h"
using namespace std;

int main() {
    long long N, Z, W;
    cin >> N >> Z >> W;
    vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    if (N == 1) {
        cout << abs(a[0] - W) << endl;
    } else {
        cout << max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])) << endl;
    }
}

Measured memory_bytes: 256
unittest
{
	assert( [ "5 3", "3 1 4", "1 5 9", "2 6 5", "3 5 8", "9 7 9" ].parse.expand.solve == 56 );
	assert( [ "5 3", "1 -2 3", "-4 5 -6", "7 -8 -9", "-10 11 -12", "13 -14 15" ].parse.expand.solve == 54 );
	assert( [ "10 5", "10 -80 21", "23 8 38", "-94 28 11", "-26 -2 18", "-69 72 79", "-26 -86 -54", "-72 -50 59", "21 65 -32", "40 -94 87", "-62 18 82" ].parse.expand.solve == 638 );
	assert( [ "3 2", "2000000000 -9000000000 4000000000", "7000000000 -5000000000 3000000000", "6000000000 -1000000000 8000000000" ].parse.expand.solve == 30000000000 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	auto xyzs = new long[][]( nm[ 0 ], 3 );
	foreach( ref xyz; xyzs )
	{
		input.popFront;
		xyz = input.front.split.to!( long[] );
	}
	return tuple( nm[ 1 ], xyzs );
}

auto solve( long m, long[][] xyzs )
{
	auto ans = 0L;
	
	// 各評価項目ごとに正方向or負方向をとった結果を計算
	auto bm = 1 << xyzs[ 0 ].length;
	for( auto b = 0; b < bm; b++ )
	{
		auto ts = new long[]( xyzs.length );
		foreach( ref t, xyz; lockstep( ts, xyzs ) )
		{
			auto bb = b;
			foreach( v; xyz )
			{
				if( bb & 1 ) t += v;
				else         t -= v;
				bb >>= 1;
			}
		}
		ts.sort!( ( a, b ) => b < a );
		ans = max( ans, ts.take( m ).sum );
	}
	
	return ans;
}


Measured memory_bytes: 2556
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)   
typedef long long ll;
const ll mod=1e9+7;
const ll INF=0x3f3f3f3f;
const ll maxn=1e5+5;
const ll pi = acos(-1.0);
using namespace std;
int a[maxn];
int main(){
	ll n;
	string s;
	cin>>n>>s;
	for(ll i=0;i<s.length();i++){
		a[i]=s[i]-'A'+n;
		if(a[i]>=26) a[i]-=26;
		printf("%c",a[i]+'A');
	}
	cout<<endl;
}

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

long long cnt;
int l,A[1000000],n;
vector<int>G;

void InsertionSort(int A[],int n,int g){
  for(int i=g;i<n;i++){
    int v=A[i];
    int j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j-=g;
      cnt++;
    }
    A[j+g]=v;
  }
}

void ShellSort(int A[],int n){
  for(int h=1; ; ){
    if(h>n)break;
    G.push_back(h);
    h=3*h+1;
  }

  for(int i=G.size()-1;i>=0;i--){
    InsertionSort(A,n,G[i]);
  }
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  cnt=0;

  ShellSort(A,n);
  cout<<G.size()<<endl;
  for(int i=G.size()-1;i>=0;i--){
    printf("%d",G[i]);
    if(i)printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(int i=0;i<n;i++)printf("%d\n",A[i]);
  
  return 0;
}


Measured memory_bytes: 7136
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(ll i = 0; i < (n); i++)
typedef long long ll;
const ll MOD = 1000000007;

int main()
{
    ll n, m;
    cin >> n >> m;
    if(m == 0) {
        cout << 0 << " " << 0 << endl;
        return 0;
    }

    vector<int> p(m);
    vector<string> s(m);
    rep(i, m) cin >> p[i] >> s[i];
    
    bool isAC[100100];
    int WA[100100];
    rep(i, 100100) {
        WA[i] = 0;
        isAC[i]= false;
    }

    rep(i,m){
        if(isAC[p[i]]) continue;
        else {
            if(s[i] == "WA") WA[p[i]]++;
            else {
                isAC[p[i]] = true;
            }
        }
    }

    ll ans1 = 0, ans2 = 0;
    rep(i, 100100) {
        if(isAC[i]) {
            ans1++;
            ans2 += WA[i];
        }
    }

    cout << ans1 << " " << ans2 << endl;

    return 0;
}

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

int main(){
    int N,A,B,sum,n,ans=0;
    cin>>N>>A>>B;

    for(int i=1;i<=N;i++){
        n=i;
        sum=0;
        while (n>0) {
            sum += n%10;
            n /= 10;
        }
        if(A <= sum && B >= sum){
            ans+= i;
        }
    }
    cout<<ans<<endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int > Pii;
class edge{
	public:
	int to;
	int cost;
	edge(){}
	edge(int _to,int _cost){
		to = _to;
		cost = _cost;
	}
	bool operator<(const edge &a)const{
		return cost>=a.cost;
	}
};
vector < edge > G[3002];
int path[3002];
int N,M,K;
void dijkstra(int s[3002]){

	priority_queue<edge> Q;
	rep(i,K){
		Q.push(edge(s[i],0));
	}
	while(!Q.empty()){
		edge e = Q.top();
		Q.pop();
		if(path[e.to] < INF)continue;
		path[e.to] = e.cost;
		rep(i,G[e.to].size()){
			Q.push(edge(G[e.to][i].to,G[e.to][i].cost+e.cost));
		}
	}
	return ;
}
int main(){
	scanf("%d%d%d",&N,&M,&K);
	fill(path,path+N,INF);
	rep(i,M){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;b--;
		G[a].PB(edge(b,c));
		G[b].PB(edge(a,c));
	}
	int s[3002];
	rep(i,K){
		int tmp;
		scanf("%d",&tmp);
		s[i] = --tmp;
	}
	dijkstra(s);
	double ans = 0;
	rep(i,N){
		rep(j,G[i].size()){
			int d = path[G[i][j].to]-path[i];
			if(d<0.0)continue;
			double g = path[i]+d+(G[i][j].cost-d)/2.0;
			ans = max(g,ans);
		}
	}
	printf("%.0lf\n",round(ans));
	return 0;
}

Measured memory_bytes: 5996
#include <stdio.h>

int main(void){
    int n;
    scanf("%d\n",&n);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d ",&a[i]);
    }
    //min
    int min = a[0];
    for(int t=0;t<n;t++){
        if(a[t]<min){
            min=a[t];
        }
    }
    //max
    int max = a[0];
    for(int s=0;s<n;s++){
        if(a[s]>max){
            max=a[s];
        }
    }
    //sum
    long long sum=0;
    for(int k=0;k<n;k++){
        sum += a[k];
    }
    printf("%d %d %ld\n",min,max,sum);
    return 0; /*0?????????*/
}

Measured memory_bytes: 2772
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
	char type;
	int num;
} CARD;

char before[9][4];
char after[9][4];

void swap(CARD *a, CARD *b)
{
	char tmp_c = a->type;
	int tmp_i = a->num;
	a->type = b->type;
	a->num = b->num;
	b->type = tmp_c;
	b->num = tmp_i;
}

int bubble_sort(CARD *A, int N)
{
	int i, j, cnt = 0;
	for (i = 0; i < N; i++) {
		for (j = N - 1; j >= i + 1; j--) {
			if (A[j].num < A[j - 1].num) {
				swap(&A[j], &A[j - 1]);
				cnt++;
			}
		}
	}
	return cnt;
}

int selection_sort(CARD *A, int N)
{
	int i, j, minj;
	int cnt = 0;
	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j].num < A[minj].num) {
				minj = j;
			}
		}
		if (i != minj) {
			swap(&A[i], &A[minj]);
			cnt++;
		}
	}
	return  cnt;
}

void print(CARD *card, int num)
{
	int i, j, isStable = 1;

	memset(after, '\0', sizeof(after));

	for (i = 0; i < num; i++) {
		for (j = 0; j < 4; j++) {
			if (after[card[i].num - 1][j] == '\0') {
				after[card[i].num - 1][j] = card[i].type;
				break;
			}
		}
	}

	for (i = 0; i < num; i++) {
		int card_num = card[i].num;

		if (i == num - 1) {
			printf("%c%d\n", card[i].type, card_num);
		}
		else {
			printf("%c%d ", card[i].type, card_num);
		}

		if (isStable) {
			for (j = 0; before[card_num - 1][j] != '\0' && j < 4; j++) {
				if (before[card_num - 1][j] != after[card_num - 1][j]) {
					isStable = 0;
					break;
				}
			}
		}
	}
	if (isStable) {
		printf("Stable\n");
	}
	else {
		printf("Not stable\n");
	}
}

int main(int argc, char** argv)
{
	int i, j, num;
	CARD card1[36], card2[36];

	memset(before, '\0', sizeof(before));

	scanf("%d", &num);
	for (i = 0; i < num; i++) {
		char str[4];
		memset(str, '\0', sizeof(str));
		scanf("%s", str);
		card1[i].type = str[0];
		card1[i].num = atoi(&str[1]);

		for (j = 0; j < 4; j++) {
			if (before[card1[i].num - 1][j] == '\0') {
				before[card1[i].num - 1][j] = card1[i].type;
				break;
			}
		}
	}

	memcpy(card2, card1, sizeof(card2));

	bubble_sort(card1, num);
	print(card1, num);

	selection_sort(card2, num);
	print(card2, num);

	return 0;
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
#define db(x){if(cond)cerr<<__LINE__<<" "<<#x<<" " <<x<<endl;}
#define rep(i,b)for(auto i=(0);i<(b);++i)
#define fo(i,a,b)for(auto i=(a);i<=(b);++i)
#define ford(i,a,b)for(auto i=(a);i>=(b);--i)
#define all(x) (x).begin(),(x).end()
#define vv vector
#define pb push_back
template<typename X>void MA(X&a,X b){a=max(a,b);}template<typename X>void MI(X&a,X b){a=min(a,b);}
template<typename X>void clr(X&x,int a){memset(x,a,sizeof(a));};typedef long long ll;typedef long double ld;
typedef array<int,2>i2;typedef vv<int>vi;int cond=0,multi=0,gcj=0;

struct solver_t;solver_t *solver;
struct solver_t{

  int C[600],S[600],F[600];

  void solve(){
    int N;cin>>N;
    N--;
    rep(i,N)cin>>C[i]>>S[i]>>F[i];
    fo(i,0,N){
      int t=0;
      for(int p=i;p<N;p++){
        t=max(t,S[p]);

        t+=((F[p]-t)%F[p] + F[p])%F[p];
        t+=C[p];
      }
      cout<<t<<"\n";
    }
  }
};

void gen(){}
void brute(){}
int main(int argc,char** argv){
  fo(i,1,argc-1)if(argv[i]==string("q"))cond=1<<30;
  fo(i,1,argc-1)if(argv[i]==string("gen")){gen();exit(0);}
  fo(i,1,argc-1)if(argv[i]==string("brute")){brute();exit(0);}
  ios::sync_with_stdio(false),cin.tie(0);
  cout.setf(ios::fixed),cout.precision(10);int t;if(multi||gcj)cin>>t;else t=1;
  fo(i,1,t){if(cond)cerr<<__LINE__<<" "<<i<<endl;if(gcj)cout<<"Case #"<<i<<": ";
    solver = new solver_t();
    solver->solve();
  }return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fr(i,n) for(ll i = 0 ; i < n ; ++i)
#define vi vector<ll>
#define pb push_back
#define mp make_pair
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll n,r;
	cin>>n>>r;
	if(n >= 10)cout<<r;
	else cout<< r + 100*(10 - n);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll w,h,n,x[200],y[200],a[200],s[10],t;
  t=0;
  cin >> w >> h >> n;
  s[1]=0;
  s[2]=w;
  s[3]=0;
  s[4]=h;
  rep(i,n)cin >> x[i] >> y[i] >> a[i];
  rep(i,n){
    if(a[i]==1)s[1]=max(s[1],x[i]);
    if(a[i]==2)s[2]=min(s[2],x[i]);
    if(a[i]==3)s[3]=max(s[3],y[i]);
    if(a[i]==4)s[4]=min(s[4],y[i]);
  }
  printf("%lld",max(t,s[2]-s[1])*max(t,s[4]-s[3]));
}

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  ll mod =1e9+7;
  ll ans = 1;
  cin >> n;  
  rep1(i,n){
    ans= (ans*i)%mod;
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 256
N, T, *rest = $stdin.read.split
cts = rest.each_slice(2).to_a
ans = 10000
ts = []
cts.each do |ct|
  ts << ct[1].to_i
  if ct[1].to_i <= T.to_i and ct[0].to_i <= ans
    ans = ct[0].to_i
  end
end

if ts.min > T.to_i
  puts 'TLE'
else
  puts ans
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vs vector<string>

using namespace std;

int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

const long double Pi=acos(-1),e=2.718;
const int N=1e6+10,mod=1e9+7;


bool check(string s){
    int i=0,j=s.si-1;
    while(i<j){
        if(s[i]!=s[j])return 0;
        i++,j--;
    }
    return 1;
}

int main ()
{
    FASTIO
    string s;
    cin >> s;
    string t,p;
    int n = s.si;
    for(int i=0;i<(n-1)/2;i++){
        t += s[i];
    }
    for(int i=(n+3)/2-1;i<n;i++){
        p += s[i];
    }
    if(check(s) && check(t) && check(p)){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}
/**
*/


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

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

vector<VI> calc(int hh, int h, int ww, int w) {
  assert (hh % h != 0);
  int x = hh / h;
  // find a, b s.t. a(h - 1) - b < 0, a * hh - (b + a) * x > 0
  int lo = 2 * x * (h - 1);
  int hi = 2 * (hh - x);
  int a = 2 * x;
  int b = lo + 1;
  assert (lo < hi);
  vector<VI> ret(hh, VI(ww, -1));
  REP(i, 0, hh) {
    REP(j, 0, ww) {
      ret[i][j] = i % h == h - 1 ? -b : a;
    }
  }
  return ret;
}

int main(void){
  int hh, ww, h, w;
  cin >> hh >> ww >> h >> w;
  if (hh % h == 0 && ww % w == 0) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  bool flip = false;
  vector<VI> mat;
  if (hh % h == 0) {
    mat = calc(ww, w, hh, h);
    flip = true;
  } else {
    mat = calc(hh, h, ww, w);
  }
  REP(i, 0, hh) {
    REP(j, 0, ww) {
      int num = !flip ? mat[i][j] : mat[j][i];
      cout << num << (j == ww - 1 ? "\n" : " ");
    }
  }
}


Measured memory_bytes: 2304
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        k: u64,
    }

    let mut r = 0;
    // let mut ans = 0;
    for ans in 1..=k {
        r = (r*10+7)%k;
        if r == 0 {
            println!("{}", ans);
            return ;
        }
    }

    println!("-1");
}


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

int main()
{
  int n;
  cin>>n;
  int list[n][n];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      list[i][j]=0;
    }
  }
  for(int i=0;i<n;i++){
    int u,k,to;
    cin>>u>>k;
    u--;
    for(int j=0;j<k;j++){
      cin>>to;
      to--;
      for(int l=0;l<n;l++){
	if(l==to){
	  list[u][l]=1;
	}else{
	}
      }
    }
  }
  //print
  for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
      cout<<list[i][j]<<" ";
    }
    cout<<list[i][n-1]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3104
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
long long x[1100];
long long y[1100];
long long z[1100];
pair<long long,int>p[1100];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%lld%lld%lld",x+i,y+i,z+i);
	long long ret=0;
	for(int i=0;i<8;i++){
		for(int j=0;j<a;j++){
			long long tmp=0;
			if(i&1)tmp+=x[j];
			else tmp-=x[j];
			if(i&2)tmp+=y[j];
			else tmp-=y[j];
			if(i&4)tmp+=z[j];
			else tmp-=z[j];
			
			p[j]=make_pair(tmp,j);
		}
		std::sort(p,p+a);
		long long X=0;
		long long Y=0;
		long long Z=0;
		for(int j=0;j<b;j++){
			X+=x[p[j].second];
			Y+=y[p[j].second];
			Z+=z[p[j].second];
			
		}
		ret=max(ret,ABS(X)+ABS(Y)+ABS(Z));
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
namespace Mylib{
    using namespace std;
    
}
int main(void){
    using namespace std;
    double A,Ans;
    float PI=3.1415926535897932;
    cin >> A;
    Ans=2*A*PI;
    cout << Ans << endl;
    return 0;
    

}

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


/*
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28

1 2 3 5 6 9 10 13 17 
*/
void solve(){
    int n;
    cin >> n;
    set<int> st{1,2,3,5,6,9,10,13,17};
    if(st.count(n)==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long ll;

int getNDigits(ll a) {
  int nDigits = 0;
  while (a > 0) {
    nDigits++;
    a /= 10;
  }
  return nDigits;
}

int main() {
  ll N;
  cin >> N;

  int ans = 11;
  ll B;
  for (ll i = 1LL; i * i <= N; ++i) {
    if (N % i != 0) continue;
    B = N / i;
    ans = min(ans, max(getNDigits(i), getNDigits(B)));
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256