akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

ll prime[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  vll primes(25, 0);

  ll N;
  cin >> N;

  FOR(num, 2, N+1){
    ll tmp = num;
    while(tmp>1){
      REP(i, 25){
        if(tmp<prime[i]) break;
        if(tmp%prime[i]!=0) continue;
        primes[i]++;
        tmp/=prime[i];
        break;
      }
    }
  }

  //75 = 1*75 = 3*25 = 5*15 = 5*5*3
  //check N=100
  ll ans = 0;
  if(primes[0]+1>=75) ans++;

  ll over_25=0;
  ll over_15=0;
  ll over_5=0;
  ll over_3=0;
  REP(i, 25){
    if(primes[i]+1>=25) over_25++;
    if(primes[i]+1>=15) over_15++;
    if(primes[i]+1>=5) over_5++;
    if(primes[i]+1>=3) over_3++;
  }
  ans += over_25*(over_3-1);
  ans += over_15*(over_5-1);
  ans += over_5*(over_5-1)*(over_3-2)/2;

  cout << ans << "\n";

  return 0;
}


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

int main() {
  int a, b, c, d, p;
  int A, B;

  cin >> a >> b >> c >> d >> p;
  A = a*p; 
  B = b;
  if( p > c ) B += (p-c) * d;
  
  cout << min(A, B) << endl;
} 

Measured memory_bytes: 1160
N = int(input())
h = list(map(int, input().split()))

dp = [0]*N
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
    dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])
print(dp[-1])

Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  string S;
  cin >> S;
  ll N = S.size();

  for (ll i = 0; i < N - 1; i++)
  {
    if (S.at(i) != S.at(i + 1))
      FINALANS("Yes");
  }
  FINALANS("No");
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;



int main() {
	int a, b, c, d, e, k;

	cin >> a >> b >> c >> d >> e >> k;

	if (e - a <= k)
	{
		cout << "Yay!" << endl;
	}
	else
	{
		cout << ":(" << endl;
	}
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll dp[105][100005];

void Main() {
    int N, W;
    cin >> N >> W;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;

    rep(i, 105) {
        rep(j, 100005) {
            dp[i][j] = INF;
        }
    }

    rep(i, 105) {
        dp[i][0] = 0;
    }

    rep(i, N) {
        P item = items[i];
        rep(j, 100004) {
            if (j - item.second >= 0) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - item.second] + item.first);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    ll ans = -1;
    rrep(i, 100004, 0) {
        if (dp[N][i] <= W) {
            ans = i;
            break;
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 111;
int N;
P2 r[MC],b[MC];
bool c[MC*2];

int main(){
	cin >> N;
	repp(i,0,N){
		int x,y;
		cin >> x >> y;
		r[i] = MP(x,y);
	}
	repp(i,0,N){
		int x,y;
		cin >> x >> y;
		b[i] = MP(x,y);
	}
	sort(r,r+N); sort(b,b+N);
	int ans = 0;
	int pr = 0 , pb = 0;
	r[N] = b[N] = MP(1234567,1234567);
	while(pr < N || pb < N){
		if(r[pr].first < b[pb].first){
			c[r[pr].second] = 1;
			//cerr << "r " << r[pr].first << ' ' << r[pr].second << endl;
			++pr;
		} else {
			repm(k,b[pb].second,-1){
				if(c[k]){
					c[k] = 0;
					++ans;
					break;
				}
			}
			//cerr << "b " << b[pb].first << ' ' << b[pb].second << endl;
			++pb;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n';

int main() {
  //ios_base::sync_with_stdio(false);
  //cin.tie(0);
  int N;
  int64_t count = 0,t1,t2;
  cin >> N;
  vector<int> temp(N);
  map<int, int>times;
  for(auto&i:temp){
    cin >> i;
    ++times[i];
  }
  for(auto&i:times){
    count += (int64_t)i.second*(i.second - 1) / 2;
  }
  for(auto&i:temp){
    t1 = times.at(i);
    t1 = t1*(t1-1)/2;
    t2 = times.at(i)-1;
    t2 = t2*(t2-1)/2;
    cout << count-t1+t2 << endl;
  }
  return 0;
}

Measured memory_bytes: 8320
sa = list(input())
sb = list(input())
sc = list(input())
dic = {'a':sa,'b':sb,'c':sc}
res = 'a'
for _ in range(len(sa+sb+sc)):
    if len(dic[res])==0:
        print(res.upper())
        break
    res = dic[res].pop(0)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<vector>
#include<cassert>
#include<iomanip>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-8
#define equals(a,b) (fabs((a)-(b)) < EPS) 
using namespace std;

struct P
{
  int s,t;
  long double u;
  P(int s=0,int t=0,long double u=0):s(s),t(t),u(u){}
}; 

int N;
long double L;


bool check(int *usage,long double volume)
{
  long double tank = L;
  vector<long double> dist;

  rep(j,2)
    {
      rep(i,86400)
	{
	  tank = min(L,tank+(volume-*(usage+i)));
	  if(tank <= EPS)return false;
	}
      dist.push_back(tank);
    }
  
  return dist[0] < dist[1]+EPS;
}

int main()
{
  while(cin >> N >> L,N|(int)L)
    {
      long double mincost = 0;
      P schedule[N];
      int usage[86401];
      rep(i,86400)usage[i] = 0;
      rep(i,N)
	{
	  cin >> schedule[i].s >> schedule[i].t >> schedule[i].u;
	  REP(j,schedule[i].s,schedule[i].t)
	    usage[j] = schedule[i].u;
	}
      
      long double l = 0;
      long double r = 1100000;
      long double mid;
      rep(j,100)
	{
	  mid = (l+r)/(long double)2.0;// in
	  if(!check(usage,mid))l = mid;
	  else       r = mid;	 
	}
	 
      cout << setiosflags(ios::fixed) << setprecision(8) << mid << endl;
    }
  return 0;
}

Measured memory_bytes: 4344
import java.util.*;

public class Main{

    static class Point {
        int hh;
        int ww;
        public Point (int hh, int ww) {
            this.hh = hh;
            this.ww = ww;
        }
    }
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] s = new char[h][w];
        for(int i = 0; i < h; i++){
            s[i]  = sc.next().toCharArray();
        }
        sc.close();
        int count = 0;
        
        ArrayDeque<Point> queue = new ArrayDeque<>();
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(s[i][j] == '#'){
                    queue.add(new Point(i, j));
                }
            }
        }

        ArrayDeque<Point> queue2 = new ArrayDeque<>();

        while (queue.size() > 0) {
            while (queue.size() > 0) {
               Point p = queue.poll();
                if (p.hh != 0 && s[p.hh-1][p.ww] == '.') {
                    s[p.hh-1][p.ww] = '#';
                    queue2.add(new Point(p.hh - 1, p.ww));
                }
                if (p.hh != h - 1 && s[p.hh+1][p.ww] == '.') {
                    s[p.hh+1][p.ww] = '#';
                    queue2.add(new Point(p.hh + 1, p.ww));
                }
                if (p.ww != 0 && s[p.hh][p.ww-1] == '.') {
                    s[p.hh][p.ww-1] = '#';
                    queue2.add(new Point(p.hh, p.ww - 1));
                }
                if (p.ww != w - 1 && s[p.hh][p.ww+1] == '.') {
                    s[p.hh][p.ww+1] = '#';
                    queue2.add(new Point(p.hh, p.ww + 1));
                }
            }
            if (queue2.size() == 0) {
                break;
            }
            count++;
            ArrayDeque<Point> tmp = queue2;
            queue2 = queue;
            queue = tmp;
            
       }
       System.out.println(count);

    }
}

Measured memory_bytes: 65916
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[A];
		int[] b = new int[B];
		int amin = 100000 , bmin = 100000;
		int pricemin = 0;

		for(int i=0; i<A; i++){
			a[i] = sc.nextInt();
			if(a[i]<amin){
				amin = a[i];
			}
		}

		for(int i=0; i<B; i++){
			b[i] = sc.nextInt();
			if(b[i]<bmin){
				bmin = b[i];
			}
		}
		pricemin = amin+bmin;

		for(int i=0; i<M; i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			int c = sc.nextInt();
			int price = a[x-1]+b[y-1]-c;
			if(price<pricemin){
				pricemin = price;
			}
		}

		System.out.println(pricemin);
	}
}


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


int main() {
  int x;
  cin>>x;
  
  if(x==2){
    cout<<2<<endl;
    return 0;
  }
  
  while(true){
    bool can=true;
    for(int i=2;i<=x/2+1;i++){
      if(x%i==0){
        can=false;
        break;
      }
    }
    if(can){
      cout<<x<<endl;
      return 0;
    }
    x+=1;
  }
  
  return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = (a + b) - (c + d);
  cout << (x == 0 ? "Balanced" : (x > 0 ? "Left" : "Right")) << endl;
}


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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int INF = 1e9 + 7;


int main(void)
{
	FAST
	
	int k; cin >> k;
	string s; cin >> s;
	
	if((int)s.length() <= k) cout << s;
	else
	{
		
		cout << string(s.begin(), s.begin()+k) << "...";
		
	}
	
	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<math.h>

int main() {
	int i, j, k;
	int	n, m, h, g, c, d, l, r;
	int f = 0;
	int p[55];
	int q[55];

	scanf("%d", &n);

	for (i = 0;i < n;i++) {
		scanf("%d", &p[i]);
		q[i] = p[i];
	}

	for (i = 0;i < n;i++) {
		for (j = 0;j < n-1;j++) {
			if (p[j] > p[j + 1]) {
				m = p[j];
				p[j] = p[j + 1];
				p[j + 1] = m;
			}
		}
	}

	for (i = 0;i < n;i++) {
		if (p[i] == q[i]) {
			
		}
		else {
			f = f + 1;
		}
	}

	if (f < 3) {
		printf("YES");
	}
	else {
		printf("NO");
	}



//	printf("%d", f);

	return 0;
}

Measured memory_bytes: 128
N = int(input())
edges = [list(map(int, input().split())) for i in range(N-1)]
c = list(map(int, input().split()))
c.sort(reverse=True)
_c = c[::]

conn = [[] for i in range(N)]
for edge in edges:
    a = edge[0]-1
    b = edge[1]-1
    conn[a].append(b)
    conn[b].append(a)
ans = [0 for i in range(N)]
stack = []
stack.append(0)
checked = set()
while len(stack) > 0:
    current = stack.pop(0)
    checked.add(current)
    ans[current] = c[0]
    c.pop(0)
    for next in conn[current]:
        if next not in checked:
            stack.append(next)

print(sum(_c[1:]))
ans_str = ""
for i in range(N):
    ans_str += str(ans[i])
    if i < N-1:
        ans_str += " "
print(ans_str)







Measured memory_bytes: 8032
def lis(seq)
    n = seq.length
    return 0 if n == 0
    dp = Array.new(n, Float::INFINITY)
    ans = 1
    seq.each do |a|
        i = (0...n).bsearch { |k| a <= dp[k] }
        dp[i] = a
        ans = i + 1 if ans < i + 1
    end
    return ans
end


x1, y1, x2, y2 = gets.split.map(&:to_i)
x1, y1, x2, y2 = x2, y2, x1, y1 if x1 > x2
reverse_flag = (y1 > y2)
BIG = 10**8
if reverse_flag
    y1 = BIG - y1
    y2 = BIG - y2
end

xd, yd = x2 - x1, y2 - y1

N = gets.to_i
fs = []
N.times do |i|
    x, y = gets.split.map(&:to_i)
    y = BIG - y if reverse_flag
    if x.between?(x1, x2) && y.between?(y1, y2)
        fs.push({x: x, y: y}) 
    end
end

n = fs.length
if n == 0
    puts (xd + yd) * 100
    exit
end

fmax = lis(fs.sort_by{|f|f[:x]}.map{|f|f[:y]})

gain = fmax * (5 * Math::PI - 20)
if fmax == [xd, yd].min + 1
    gain += 5 * Math::PI
end

puts (xd + yd) * 100 + gain

Measured memory_bytes: 66296
import heapq
n, m = map(int, input().split())
jobs = [[int(x) for x in input().split()] for _ in range(n)]
jobs = sorted(jobs, key=lambda x:x[0], reverse=True)
r_jobs = list(reversed(jobs[:]))
ans = 0
q = []
cnt = 0
l = len(jobs)
for i in range(m+1):
    while cnt < l:
        if r_jobs[cnt][0] == i:
            heapq.heappush(q, -jobs.pop()[1])
            cnt += 1
        else:
            break

    if q:
        ans += -heapq.heappop(q)

print(ans)


Measured memory_bytes: 25736
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a, b)

ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))
print(ans)


Measured memory_bytes: 79640
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int W = sc.nextInt(); int H = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int r = sc.nextInt();
		if ((r<=x&&x<=W-r) && (r<=y&&y<=H-r)) {
			System.out.println("Yes");
		}
		else System.out.println("No");
		
	}
}


Measured memory_bytes: 26292
N = int(input())
A = list(map(lambda x: int(x)-1, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

result = 0
for i in range(N):
    result += B[A[i]]
    if 1<=i:
        if A[i-1]+1==A[i]:
            result += C[A[i-1]]

print(result)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	
	static int[][] map;
	
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main app = new Main();
		
		while(true){
			map = new int[12][];
			for(int i = 0; i < 12; i++)
				map[i] = app.toIntegerArrays(reader.readLine().toCharArray());
			
			int count = 0;
			for(int i = 0; i < 12; i++){
				for(int j = 0; j < 12; j++){
					if(map[i][j] == 1){
						app.check(i, j);
						count++;
					}
				}
			}
			System.out.println(count);
			
			if(reader.readLine() == null) break;
		}
		
		isr.close();
		reader.close();
	}
	
	public void check(int x, int y){
		if(x > 11 || y > 11 || x < 0 || y < 0 || map[x][y] == 0) return;
		map[x][y] = 0;
		check(x + 1, y);
		check(x - 1, y);
		check(x, y + 1);
		check(x, y - 1);
	}
	
	public int[] toIntegerArrays(char[] array){
		int[] result = new int[12];
		for(int i = 0; i < 12; i++) result[i] = (int)array[i] - (int)'0';
		return result;
	}
	
}

Measured memory_bytes: 24056
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
 #define mod 1000000007
#define ceil(a,b) (a+b-1)/b
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
    cin>>n;
    int a[n];
    for(int x=0;x<n;x++){
        cin>>a[x];
    }
    sort(a,a+n);
    int ans=0;
    int ans1=0;
    for(int i=0;i<n-2;i++){
        ans1=0;
        int a1=a[i];
        int a2=a[i+1];
        int a3=a[i+2];
        int z=2;
        while(a3-a2<a1&&a1+a2>a3){
            ans1++;
            ans++;
            z++;
            //a3=a[i+z];
            if(i+z==n){
                break;
            }
            a3=a[i+z];
        }
        int y=2;
        //ans1--;
        a2=a[i+2];
        while(i+y<n-1){
            if(ans1!=0)
            ans1--;
            a2=a[i+y];
            if(y==z){
                z++;
            }
            a3=a[i+z];
            while(a3-a2<a1&&a1+a2>a3){
                ans1++;
                z++;
                if(i+z==n){
                    break;
                }
                a3=a[i+z];
            }
            ans+=ans1;
        y++;
        }
    }
    cout<<ans;








	
return 0;
}


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

const int N = 320; //max size of vertex
const int inf = 1<<29;

int cap[N][N],flow[N][N];
int level[N];
bool finished[N];
int n;

inline int residue(int s,int t) { return cap[s][t] - flow[s][t]; }

void makeLevel(int s) {
    memset(level, -1, sizeof(level));
    level[s] = 0;
    queue<int> Q; Q.push(s);
    while(!Q.empty()) {
        int here = Q.front(); Q.pop();
        for(int there=0; there<n; ++there) {
            if(level[there] < 0 && residue(here,there) > 0) {
                level[there] = level[here]+1;
                Q.push(there);
            }
        }
    }
}

int augment(int here,int curf,int t) {
    if(here == t || curf == 0) return curf;
    if(finished[here] != 0) return 0;
    finished[here] = 1;
    for(int there=0; there<n; ++there) {
        if(level[there] > level[here]) {
            int f = augment(there, min(curf, residue(here, there)), t);
            if(f > 0) {
                flow[here][there] += f;
                flow[there][here] -= f;
                finished[here] = false;
                return f;
            }
        }
    }
    return 0;
}

int Dinic(int s,int t) {
    memset(flow, 0, sizeof(flow));
    int ret = 0;
    for(bool cont = true; cont; ) {
        cont = false;
        makeLevel(s);
        memset(finished, 0, sizeof(finished));
        for(int f; (f = augment(s, inf, t)) > 0; cont = true)
            ret += f;
    }
    return ret;
}

int main() {
    int m,a,b,s,t;
    cin>>n>>m;
    vector<pair<int,int> > e;

    for(int i=0; i<m; ++i) {
        cin>>a>>b;
        a--,b--;
        cap[a][b] = cap[b][a] = 1;
        e.push_back(make_pair(a,b));
    }
    cin>>s>>t;
    s--,t--;

    int f = Dinic(s,t);
    cout<<f<<endl;
    vector<int> reversed;
    for(int i=0; i<m; ++i)
        if(flow[e[i].second][e[i].first] > 0) 
            reversed.push_back(i+1);

    cout<<reversed.size()<<endl;
    for(int i=0; i<reversed.size(); ++i)
        cout<<reversed[i]<<endl;
}

Measured memory_bytes: 0
#include <stdio.h>

 int main(void){
 int a, b, c;

 scanf("%d%d%d", &a, &b, &c);

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }
 return 0;
 }

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

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

    map<ll, int> m;
    vector<ll> a;

    REP(i,N){
        ll tmp;
        cin >> tmp;
        m[tmp]++;
        if(m[tmp] % 2 == 0){
            a.push_back(tmp);
        }
    }
    if(a.size() > 1){
        sort(a.begin(),a.end());
        cout << a[a.size()-1] * a[a.size()-2] << endl;
    }else{
        cout << 0 << endl;
    }

}

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

int main() {
  int N;
  int i, j, k, l;
  
  cin >> N;

  i = N % 10;
  j = (N / 10) % 10;
  k = (N / 100) % 10;
  l = N/1000;

  if ((i == j) && (j == k)) {
    cout << "Yes" << endl;
  } else if ((j == k) && (k == l)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai 3.14159265358979323846264338327950288;
#define keta(n) cout << fixed << setprecision((n));
using ll = long long;
int main(){
  double a,b,h,m,kH,kM,l,kaku;
  cin>>a>>b>>h>>m;
  kH = (h/12+m/720)*2*pai;
  kM = (m/60)*2*pai;
  kaku = kH-kM;
  
   l = (a*a + b*b - 2*a*b*cos(kaku)) ;
  l =  sqrt(l);
  keta(20);
  cout<<l<<endl;



}


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

#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rev(a) (a).rbegin(),(a).rend()
#define pll pair<ll,ll>
#define rep(i,a,b) for(long long i = (a); i <= (b); i++)

const int mod = 1e9+7;
const int N = 1e5+5; 

int main(){
	fast;
	ll t = 1; 
	//cin >> t;
	while(t--){
	    string s; cin >> s;
	    set<char> st;
	    for(auto x : s){
	        st.insert(x);
	    }
	    
	    if(st.size() > 1) cout << "Yes\n";
	    else cout << "No";
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N, a=1, s[1<<18];

    scanf("%d", &N);

    for (int i = 0; i < 1<<N; i++) scanf("%d", &s[i]);

    while (1) {
        for (int i = 0; i < 1<<N; i+=2*a)
            if (s[i] > s[i+a]) {
                s[i] = s[i] - s[i+a];
            } else if (s[i] < s[i+a]) {
                s[i] = s[i+a] - s[i];
            } else {
                s[i] = s[i];
            }
        a*=2;
        if (a > 1<<N) {
            printf("%d", s[0]);
            return 0;
        }
    }
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int p(ll x){
    if(x==6)return 21;
    if(x==5)return 13;
    if(x==4)return 8;
    if(x==3)return 5;
    if(x==2)return 3;
    if(x==1)return 2;
    return 1;
}
int main(){
    ll h,w,k;cin >> h >>w >>k;k--;
    ll dp[h+1][w];
    rep(i,h+1)rep(j,w)dp[i][j]=0;
    dp[0][0]=1;
    rep(i,h){
        rep(j,w){
            if(j-1>=0){
                dp[i+1][j-1]+=p(w-j-2)*p(j-2)*dp[i][j];
                dp[i+1][j-1]%=MOD;
            }
            if(j+1<w){
                dp[i+1][j+1]+=p(j-1)*p(w-3-j)*dp[i][j];
                dp[i+1][j+1]%=MOD;
            }
            dp[i+1][j]+=dp[i][j]*p(w-j-2)*p(j-1);
            dp[i+1][j]%=MOD;
        }
    }
    cout << dp[h][k] <<endl;
}

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

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

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] h = new int[n];
		
		for(int i=0;i<n;i++) {
			h[i] = sc.nextInt();
		}
		
		//木の高さでソート
		Arrays.sort(h);
		
		//k本右隣の木との差を計算する
		// 木がn本なら、dの要素数は n-(k-1)になる
		/*
		 * n=5, k=3
		 * 0 1 2 3 4 
		 * <--->
		 *   <--->
		 *     <--->
		 */
		int[] d = new int[n-(k-1)];
		
		for(int i=0;i<n-(k-1);i++) {
			d[i] = h[i+(k-1)] - h[i];
		}
		/*
		 * ↑一度配列にいれるのではなく、差のminを保持しないと、
		 * ソートの分の O(NlogN) が余計に時間がかかってしまっている。
		 */
		
		//差が小さい順にソート
		Arrays.sort(d); 
		
		out.println(d[0]);
		
		sc.close();

	}

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

}


Measured memory_bytes: 51312
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n,m;
    cin >> n >> m;
    int s[m];
    char c[m];
    rep(i,m){
        cin >> s[i] >> c[i];
        s[i]--;
    }
    if(n == 1){
        for(int i = 0; i <= 9; i++){
            string t = to_string(i);
            rep(j,m){
                if(t[s[j]] != c[j]) goto no;
            }
            cout << i << endl;
            return 0;
            no:;
        }
    }else if(n == 2){
        for(int i = 10; i <= 99; i++){
            string t = to_string(i);
            rep(j,m){
                if(t[s[j]] != c[j]) goto no2;
            }
            cout << i << endl;
            return 0;
            no2:;
        }
    }else{
        for(int i = 100; i <= 999; i++){
            string t = to_string(i);
            rep(j,m){
                if(t[s[j]] != c[j]) goto no3;
            }
            cout << i << endl;
            return 0;
            no3:;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"time"
)

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

type pair struct {
	i, j int
}

func calc(f func()) {
	start := time.Now()
	f()
	fmt.Println(time.Now().Sub(start))
}

func solve() {
	H, W := nextInt(), nextInt()
	S := make([][]string, H)
	for i := 0; i < H; i++ {
		S[i] = strings.Split(nextLine(), " ")
	}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if S[i][j] == "snuke" {
				out(string('A'+j) + strconv.Itoa(i+1))
				return
			}
		}
	}
}


Measured memory_bytes: 640
#include<stdio.h>

int main (){
	int N,i,j;
	scanf("%d",&N);
	float v[N];
	float tmp;
	for (i=0;i<N;i++){
		scanf("%f",&v[i]);
	}
	for (i=0;i<N;i++) {
		for (j=i+1;j<N;j++) {
			if (v[i]>v[j]) {
				tmp=v[i];
				v[i]=v[j];
				v[j]=tmp;
			}
		}
	}
	float sum = v[0];
	for (i=1;i<N;i++) {
		sum = (sum + v[i]) / 2;
	}
	printf("%f\n", sum);
	return 0;
}


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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(ll size) {
        size = max((int) sqrt(size) + 1, 101010);
        prime.resize(size, 1);
        prime[0] = 0;
        prime[1] = 0;
        for (size_t i = 2; i * i <= size; ++i)
            if (prime[i]) {
                for (size_t j = 2; i * j <= size; ++j)prime[i * j] = false;
            }
    }
};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll N, K;

int main() {
    cin >> N >> K;
    vector<int> A(N), B(N), C(N);
    REP(i, N)cin >> A[i];
    REP(i, N) {
        REP(k, N) {
            if (i < k)if (A[i] > A[k])B[i]++;
            if (A[i] > A[k])C[i]++;
        }
    }
    ll res = 0;
    REP(i, N) {
        res += K * B[i] % MOD;
        res %= MOD;
        res += K * (K - 1) / 2 % MOD * C[i] % MOD;
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifndef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

ll a[66];

int main()
{
	file();
	ll K;read(K);
	int n;
	if (K<1e16) n=2; else n=50;
	printf("%d\n",n);
	rep(i,1,n) a[i]=K/n+n-1;K%=n;
	while (K--) { a[rnd(1,n)]+=n+1; rep(i,1,n) a[i]--; }
	rep(i,1,n) printf("%lld ",a[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int f[105][10];
	rep(i, n) {
		rep(j, 10) {
			cin >> f[i][j];
		}
	}
	vector<vector<int>> P(n, vector<int>(11));
	rep(i, n)rep(j, 11) cin >> P[i][j];
	int ans = -inf;
	rep(bit, (1 << 10)) {
		vector<int> rec(n);
		int cnt = 0;
		rep(i, 10) if (bit & (1 << i)) cnt++;
		if (cnt == 0) continue;
		rep(i, n) {
			rep(j, 10) if (bit & (1 << j) && f[i][j]) rec[i]++;
		}
		int tmp = 0;
		rep(i, n) {
			tmp += P[i][rec[i]];
		}
		maxs(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

bool a[200001];
bool b[200001];
int main(){
    int N,M;
    cin >> N >> M;
    int inpa;
    int inpb;
    REP(i,M){
        cin >> inpa;
        cin >> inpb;
        if(inpb == N){
            b[inpa] = true;
        }
        if(inpa == 1){
            a[inpb] = true;
        }
    }

    bool ans = false;
    REP(i,N+1){
        //cout << a[i] << " " << b[i] << endl;
        if(a[i] && b[i])
            ans = true;
    }

    if(ans)
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 640
import scala.io.StdIn

object Main extends App {
  val n  = StdIn.readLine().toInt
  val b :Array[Int] = StdIn.readLine().split(" ").map(_.toInt)
  var a :Array[Int] = Array(b.head)
  (0 to b.length - 2).foreach {i =>
    val c = List(b(i), b(i + 1)).min
    a = a :+ c
  }
  a = a :+ b.reverse.head
  print(a.sum)

}


Measured memory_bytes: 25420
N= int(input())
S=[]
ac,tle,wa,re=0,0,0,0
for i in range(N):
    inp=input()
    if inp=="AC":
        ac+=1
    elif inp=="TLE":
        tle+=1
    elif inp=="WA":
        wa+=1
    elif inp=="RE":
        re+=1

print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

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

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

    set<int> s;
    long long ans = 0;
    for (int x = n - 1; x >=0; x--){
        int i = idx[x];
        long long c = 0;
        
        s.insert(i);
        
        auto it1 = s.find(i);
        auto it2 = it1;

        vector<int> l(2, -1);
        for (int j = 0; j < 2; j++){
            if (it1 == s.begin()) break;
            it1--;
            l[j] = *it1;
        }
        
        vector<int> r(2, n);
        for (int j = 0; j < 2; j++){
            it2++;
            if (it2 == s.end()) break;
            r[j] = *it2;
        }
        
        vector<int> ls(2);
        ls[0] = i - l[0];
        ls[1] = l[0] - l[1];
        
        vector<int> rs(2);
        rs[0] = r[0] - i;
        rs[1] = r[1] - r[0];
        
        c = ls[0] * rs[1] + ls[1] * rs[0];
        
        ans += c * (x + 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int[] num = new int[3];
		int i = 0;
		while (input.hasNextInt()) {
			num[i++] = input.nextInt();
		}
		if(num[0] == num[1]) {
			System.out.println(num[2]);
		}else if (num[0] == num[2]) {
			System.out.println(num[1]);
		} else {
			System.out.println(num[0]);
		}
	}
}

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

int	main()
{
	int	r, c;
	cin >> r >> c;
	vector<int>	c_sum(c + 1, 0);
	int	val, sum;
	for (int i = 0; i < r; ++i) {
		sum = 0;
		for (int j = 0; j < c; ++j) {
			cin >> val;
			c_sum.at(j) += val;
			cout << val << " ";
			sum += val;
		}
		c_sum.at(c) += sum;
		cout << sum << endl;
	}
	for (int j = 0; j < c; ++j)
		cout << c_sum.at(j) << " ";
	cout << c_sum.at(c) << endl;
}



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

using namespace std;

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

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

    long long sum = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                sum += gcd(gcd(a, b), c);
            }
        }
    }
  
    cout << sum << endl;
    return 0;
}

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

int main() {
  uint32_t n = 0, k = 0;
  std::cin >> n >> k;
  std::array<uint32_t, 100'000> weight;
  uint32_t max_weight = 0, sum_weight = 0;
  for (size_t i = 0; i < n; i++) {
    std::cin >> weight[i];
    if (max_weight < weight[i]) max_weight = weight[i];
    sum_weight += weight[i];
  }

  uint32_t start = max_weight, end = sum_weight;
  uint32_t P = 0;
  while (end != start) {
    P = (start + end) / 2;
    uint32_t num = 1, current = 0;
    for (size_t i = 0; i < n; i++) {
      if (current + weight[i] > P) {
        num++;
        current = 0;
      }
      current += weight[i];
    }

    if (num <= k)
      end = P;
    else
      start = P + 1;
  }
  std::cout << start << std::endl;

  return 0;
}


Measured memory_bytes: 3488
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple


int main(void)
{
    ll A, B, K;
    cin >> A >> B >> K;
    if(A+B <= K){
        printf("%d %d\n", 0, 0);
    }else if((A <= K) && (A+B > K)){
        printf("%d %lld\n", 0, B-(K-A));
    }else{
        printf("%lld %lld\n", A-K, B);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int a, b, c;
    string op;

    while(1) {
        cin >> a >> op >> b;
        if (op == "?")
            break;
        else if (op == "+")
            c = a + b;
        else if (op == "-")
            c = a - b;
        else if (op == "*")
            c = a * b;
        else if (op == "/")
            c = a / b;
        else
            continue;
        cout << c << endl;
    }
    return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 2;

void solve() {
    ll N; cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }
    ll ans = INF64;
    for (int i = 0; i <= 100; ++i) {
        ll tmp = 0;
        for (int j = 0; j < N; ++j) {
            tmp += (A[j]-i)*(A[j]-i);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 256
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
P2 = [ (p+1)/2 for p in P]

# print(P2)
s = sum(P2[0:K])
ans = s
for i in range(0,N-K):
    s -= P2[i]
    s += P2[i+K]
    ans = max(ans,s)    
    # print(s)
    
print(ans)


Measured memory_bytes: 25188
#include<stdio.h>
int S[1000000],n;
int binary(int key){
    int left=0,right=n,mid;
    while(left<right){
        mid=(left+right)/2;
        if(key==S[mid]){
            return 1;
        }
        if(key>S[mid]){
            left=mid+1;
        }else if(key<S[mid])right=mid;
    }
    return 0;
}
int main(){
    int num=0,i,key,q;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&key);
        if(binary(key) )num++;
    }
    printf("%d\n",num);
      return 0;
    }



Measured memory_bytes: 2104
#include<stdio.h>
int main()
{
int n,i;
  scanf("%d",&n);
long long int sw1[n],sw2[n],a[n],ans;
  ans=0;
  for(i=0;i<n;++i)
  {
  sw1[i]=0;
  sw2[i]=0;
  scanf("%lld",&a[i]);
  }
  
  for(i=0;i<n;++i)
  {
  if(i-a[i]>=0) sw1[i-a[i]]++;
  if(i+a[i]<n) sw2[i+a[i]]++;
  }
  
  for(i=0;i<n;++i)
  {
  ans=ans+sw1[i]*sw2[i];
  }
  
  printf("%lld",ans);

return 0;}

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

int main(){
    long long int num,tai,sin;
    cin >> num;
    vector<long long int> su(num);
    for(int i=0;i<num;i++){
        cin >> su.at(i);
    }
    sin = 0;
    tai = 0;
    for(int i = 1;i<num;i++){
        if(su.at(i) < su.at(i-1)){
            sin = su.at(i - 1)-su.at(i);
            tai += sin;
            su.at(i) = su.at(i -1);
        }
    }
    cout << tai;
}

Measured memory_bytes: 4840
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    a,b,c,d = IR(4)
    print(min(a,b)+min(c,d))

#B
def B():
    n = I()
    d,x = LI()
    a = IR(n)
    for i in range(1,d+1):
        for j in a:
            if (i-1)%j == 0:
                x += 1
    print(x)
#C
def C():
    n = I()
    a = LI()
    ans = abs(a[0])
    for i in range(n-1):
        ans += abs(a[i+1]-a[i])
    ans += abs(a[-1])
    a.insert(0,0)
    a.append(0)
    for i in range(1,n+1):
        if a[i-1] <= a[i] <= a[i+1] or a[i+1] <= a[i] <= a[i-1]:
            print(ans)
        else:
            print(ans-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]))
#D
def D():
    a,b = LI()
    ans = [["."]*50+["#"]*50 for i in range(100)]
    for i in range(100):
        for j in range(50):
            if b == 1:break
            if i%2 == 0 and j%2 == 0:
                ans[i][j] = "#"
                b -= 1
        if b == 1:
            break
    for i in range(100):
        for j in range(50,100):
            if a == 1:break
            if i%2 == 0 and j%2 == 1:
                ans[i][j] = "."
                a -= 1
        if a == 1:
            break
    print(100,100)
    for i in ans:
        for j in i:
            print(j,end = "")
        print()
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 46936