akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr)
#define fix(n) fixed << setprecision(n)

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    fast_io();
    
    ll a,b;
    string s;

    cin >> a >> b >> s;
    ll i = 0;

    for(;i < a;i++){
        if(s[i] < '0' || '9' < s[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    if (s[i] != '-'){
        cout << "No" << endl;
        return 0;
    }

    i++;

    for(;i < a + b + 1;i++){
        if(s[i] < '0' || '9' < s[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <bitset>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef __APPLE__
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif
 
int main(){
    int n;
    cin >> n;
    cout << (n>=30?"Yes":"No");
}

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

struct node {
	int parent;
	int child[2];
	int depth;
	int brother;
};

struct node tree[100000];

int getRoot(int num){
	if(tree[num].parent == -1){
		return num;
	}
	return getRoot(tree[num].parent);
}

void calcDepth(int num){
	int i;
	for(i=0;i<2;i++){
		if(tree[num].child[i] == -1){
			continue;
		}
		tree[tree[num].child[i]].depth = tree[num].depth + 1;
		calcDepth(tree[num].child[i]);
	}
	return;
}
/*
int calcHeight(int num){
	int i;
	int temp;
	int h = -1;
	if(num==-1){
		return -1;
	}
	for(i=0;i<2;i++){
		temp = calcHeight(tree[num].child[i]);
		h = (h>temp?h:temp);
	}
	tree[num].height = h + 1;
	return tree[num].height;
}
*/
void Preorder(int num){
	printf(" %d",num);
	if(tree[num].child[0]==-1){
		if(tree[num].child[1]==-1){
			return;
		}else{
			Preorder(tree[num].child[1]);
		}
		return;
	}
	Preorder(tree[num].child[0]);
	if(tree[num].child[1]==-1){
		return;
	}
	Preorder(tree[num].child[1]);
}

void Inorder(int num){
	if(tree[num].child[0]==-1&&tree[num].child[1]==-1){
		printf(" %d",num);
		return;
	}else if(tree[num].child[0]==-1&&tree[num].child[1]!=-1){
		printf(" %d",num);
		Inorder(tree[num].child[1]);
	}else if(tree[num].child[0]!=-1&&tree[num].child[1]==-1){
		Inorder(tree[num].child[0]);
		printf(" %d",num);
	}else{
		Inorder(tree[num].child[0]);
		printf(" %d",num);
		Inorder(tree[num].child[1]);
	}
	return;
}

int Postorder(int num){
	if(num==-1){return;}
	Postorder(tree[num].child[0]);
	Postorder(tree[num].child[1]);
	printf(" %d",num);
	return;
}

int main(){
	int n;
	int nodenum;
	int l;
	int r;
	int root;
	int i,j;
	scanf("%d",&n);

	for(i=0;i<n;i++){
		tree[i].parent = -1;
		tree[i].brother = -1;
	}

	for(i=0;i<n;i++){
		scanf("%d",&nodenum);
		scanf("%d %d",&l,&r);
		tree[nodenum].child[0] = l;
		tree[nodenum].child[1] = r;
		if(l != -1){
			tree[l].parent = nodenum;
			tree[l].brother = r;	
		}
		if(r != -1){
			tree[r].parent = nodenum;
			tree[r].brother = l;
		}
	}

	root = getRoot(0);

	tree[root].depth = 0;
	calcDepth(root);

	printf("Preorder\n");
	Preorder(root);
	printf("\n");
	printf("Inorder\n");
	Inorder(root);
	printf("\n");
	printf("Postorder\n");
	Postorder(root);
	printf("\n");
	return 0;
}

Measured memory_bytes: 616
import java.util.Scanner;

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

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
}


Measured memory_bytes: 23764
#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,j,w[11][11]={0};
  int x,y,n,d=1,m=0;
  int X[]={-1, 0, 1, 1, 2, 1, 1, 0,-1,-1,-2,-1};
  int Y[]={-1,-2,-1,-1, 0, 1, 1, 2, 1, 1, 0,-1};
  for(i=0;i<9;i++){
    scanf("%d",&n);
    for(j=3-(i%2);j<11;j+=2){
      w[i+1][11-j]=n%10;
      n/=10;
    }
  }
  y=1;
  x=2;
  if(w[1][2]==1){
    printf("R");
    while(1){
      m=0;
      for(i=0;i<3;i++){
	if(w[y+Y[d*3+i]][x+X[d*3+i]]==1){
	  x+=X[d*3+i];
	  y+=Y[d*3+i];
	  d+=i-1;
	  m=1;
	  break;
	}
      }
      if(m==0){
	d+=2;
      }
      d+=4;
      d%=4;
      if(d==0)printf("U");
      if(d==1)printf("R");
      if(d==2)printf("D");
      if(d==3)printf("L");
      if(x==2&&y==1)break;
    }
    printf("\n");
    return 0; 
  }
}
	

Measured memory_bytes: 568
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  int64 a, b, c;
  cin >> a >> b >> c;
  int64 d = c - b - a;
  if (d >= 0 && 4 * a * b < d * d) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next();

        int cnt = 0;
        int ans = 0;
        for (int i = 0; i < s.length(); ++i) {
            if (s.charAt(i) == 'R') {
                ++cnt;
                ans = Math.max(ans, cnt);
            }
            else cnt = 0;
        }

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() { return Double.parseDouble(next());}
}




Measured memory_bytes: 32540
#include<iostream>
#include<algorithm>
#include<vector>

int main(void){
    long long  a, b, c;
    std::cin >> a >> b >> c;

    //1つでも偶数ならば答えは０
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
        std::cout << 0 << std::endl;
        return 0;
    }

    //すべての辺の長さが奇数である

    std::vector<long long> check = {a, b, c};
    std::sort(check.begin(), check.end());

    long long  ans = check[0] * check[1];

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

Measured memory_bytes: 256
def invNum(d,A):
    if d < 0 or len(A) < 2: return 0
    cnt = 0
    L = []
    R = []
    for ai in A:
        if ai < 2**d:
            L.append(ai)
            cnt += len(R)
        else:
            R.append(ai-2**d)
    return cnt + invNum(d-1,L) + invNum(d-1,R)
 
if __name__=='__main__':
    n = int(input()) 
    print(invNum(29,list(map(int,input().split()))))

Measured memory_bytes: 44316
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define in insert
  #define ld long double


  #define TRACE
  #ifdef TRACE
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  template <typename Arg1>
  void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
  }
  template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  }
  #else
  #define trace(...) 1
  #endif
  template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
  template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
  template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
  typedef long long int ll;

  typedef vector<int> vi;
  typedef vector<ll> vl;
  typedef vector<vi> vvi;
  typedef vector<vl> vvl;
  typedef pair<int,int> pii;
  typedef pair<ll,ll> pll;
  typedef vector<pii> vpii;
  typedef vector<pll> vpll;
  #define int ll
  const ll mod =1e9+7;
  const ll MAX_NODES =200001;
  const ll MAX_LOG =50;
  const ll maxn = 400000+10;
  #define endl '\n'
const ll md = (ll) 1e9 + 7;
 
inline ll add(ll a, ll b) {
  a += b;
  if (a >= md) a -= md;
  return a;
}
 
inline ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += md;
  return a;
}
 
inline ll mul(ll a, ll b) {
  return (ll) ((long long) a * b % md);
}
 
inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
 
inline ll inv(ll a) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
vector<int> fact(maxn+5);
void init (int n)
{
  fact[0] = 1;
  for(int i = 1;i<=n;i++)
  {
    fact[i] = mul(i,fact[i-1]);
  }
}
int nck(int n,int k)
{
  return mul(fact[n],mul(inv(fact[k]),inv(fact[n-k])));
}

  int32_t main()
  {

  IOS
  int n;
  cin>>n;
  init(n+1);
  int a[n+2];
  int pos1,pos2;
  map<int,int> m;
  for(int i = 1;i<=n+1;i++)
  {
    cin>>a[i];
    if(m.count(a[i]))
    {
      pos1 = m[a[i]];
      pos2 = i;
    }
    m[a[i]] = i;

  }
  int ans[n+2];
  
  for(int i = 1;i<=n+1;i++)
  {
    ans[i] = nck(n+1,i);
    if(n+1-pos2+pos1-1>=i-1)
      ans[i] = sub(ans[i],nck(n-pos2+pos1,i-1));
    cout<<ans[i]<<"\n";
  }
  
   
  


  

  
    
  
 
  


  
  

}


Measured memory_bytes: 12160
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <chrono>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <deque>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdarg.h>
#include <utility>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unisgned long long
#define ld long double
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))
#define pii pair<int, int>
#define tii triple<int, int, int>
#define e 1e-7
#define PI acos(-1)
#define sz(a) (int)(a.size())
#define inf 1e17
#define vi vector<int>
#define F first
#define S second
#define rng(x) for(int _ = 0; _ < (x); _++)
#define rngi(i, x) for(int i = 0; i < (x); i++)
#define rngsi(s, i, x) for(int i = (s); i <(x); i++)
#define int long long
#define problem ""

template<typename A, typename B, typename C>
struct triple{
    A X;
    B Y;
    C Z;
    triple(A a = 0, B b = 0, C c = 0) :X(a), Y(b), Z(c) {}
};
template<typename A, typename B, typename C>
triple<A, B, C> make_triple(A a = 0, B b = 0, C c = 0){
    return triple<A, B, C>(a, b, c);
}
template<typename A, typename B, typename C>
bool operator<(const triple<A, B, C>& a, const triple<A, B, C>& b){
    if (a.X != b.X)
        return a.X < b.X;
    if (a.Y != b.Y)
        return a.Y < b.Y;
    return a.Z < b.Z;
}
template<typename T, typename SS>
ostream& operator<<(ostream& ofs, const pair<T, SS>& p){
    ofs << "( " << p.F << " , " << p.S << " )";
    return ofs;
}
template<typename T>
void print(T a){
    for (auto i : a)
        cout << i << ' ';
    cout << '\n';
}
template<typename T>
T max(T a, T b, T c){
    return max(a, max(b, c));
}
template<typename T>
T min(T a, T b, T c){
    return min(a, min(b, c));
}
template<typename T, typename D>
D min(T a){
    return *min_element(all(a));
}
template<typename T, typename D>
D max(T a){
    return *max_element(all(a));
}
struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void solve(){
    int n; cin >> n;
    int ans = 0;
    rngi(i, n) ans += (i + 1) * (n - i);
    rng(n - 1){
        int x, y; cin >> x >> y;
        if(x > y) swap(x, y);
        ans -= x * (n - y + 1);
    }
    cout << ans << '\n';
};
signed main()
{
    if(0){
        freopen(problem".in", "r", stdin);
        freopen(problem".out", "w", stdout);
    }
    srand(time(NULL));
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    int t = 1; //cin >> t;
    rng(t) solve();
}


Measured memory_bytes: 3152
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int i, j;
    cin >> i >> j;
    if(i > j)
        cout << "a" << " > " << "b" <<endl;
    else if(i < j)
        cout << "a" << " < " << "b" << endl;
    else
        cout << "a" << " == " << "b" << endl;
}

Measured memory_bytes: 3108
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main{
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char a='a';
		String str;
		int count[]=new int['z'-a+1];
		for(;(str=br.readLine())!=null;){
			for(int i=0;i<str.length();i++){
				if(Character.isLetter(str.charAt(i)))
					count[Character.toLowerCase(str.charAt(i))-'a']++;
			}
		}
		for(int i=0;i<26;i++)
			System.out.println(a++ +" : "+count[i]);
		
	
	
	}}

Measured memory_bytes: 17012
H,W,K = list(map(int,input().split()))
C = []
for i in range(H):
    C.append(list(input()))

from itertools import product
HS = list(product([0,1], repeat=H))
WS = list(product([0,1], repeat=W))
out = 0
for H1 in HS:
    for W1 in WS:
        cnt = 0
        for i in range(H):
            for j in range(W):
                if H1[i]!=1 and W1[j]!=1 and C[i][j]=="#":
                    cnt+=1
        if cnt==K:
            out += 1
print(out)

Measured memory_bytes: 68148
#include <iostream>
#include <fstream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <list>
#include <array>
#include <cstdlib>
#include <stack>
#include <string>
#include <queue>
#include <chrono>
#include <functional>
#include <limits>
#include <cmath>
#include <algorithm>
#include <random>
#include <regex>
#include <tuple>
#include <numeric>
#include <cassert>
#include <utility>
#include <bitset>
#include <complex>
#include <iomanip>
#include <ostream>
#include <sstream>
#include <ctime>
using namespace std;
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define index INDEX
#ifndef ONLINE_JUDGE
#define print(x) PRINT(x, #x)
template<typename T> void PRINT(T VARIABLE, const string& NAME) {
	cerr << NAME << " = " << fixed << VARIABLE << "\n";
}
#else
#define print(x) 0 
#endif
int generate_random() {
	const int MAX_RANDOM = (int)1e6;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	return uniform_int_distribution<int>(0, MAX_RANDOM)(rng);
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INFLL = 2 * (ll)1e18 + 100;
#define int ll
#ifdef int 
const int INFINT = INFLL;
#else
const int INFINT = 2 * (int)1e9 + 100;
#endif
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const int SEED = (int)1e3 + 7;
const int MOD = (int)1e9 + 7;
const int NMAX = (int)1e3 + 5;

char mat[NMAX][NMAX];
int dp[NMAX][NMAX];

int32_t main() {
#ifndef ONLINE_JUDGE
	double START_PROGRAM = clock();
#endif
	srand(time(NULL));
	cout << setprecision(20) << fixed;
	FASTIO;
    int n, m;
    cin >> n >> m;

    for1(i, n) for1(j, m) cin >> mat[i][j];
    dp[1][1] = 1;

    for1(i, n) for1(j, m)
    {
        if(i * j != 1 && mat[i][j] != '#')
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    }
    cout << dp[n][m];




#ifndef ONLINE_JUDGE
	double END_PROGRAM = clock();
	double ELAPSED_TIME = (END_PROGRAM - START_PROGRAM) / CLOCKS_PER_SEC;
	cerr << "\n\nElapsed Time: " << ELAPSED_TIME * 1000 << "\n";
#endif
	return 0;
}






Measured memory_bytes: 9088
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
int s[100010];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&s[i]);
    sort(s+1,s+n+1);
    int cnt=0;
    long long a=0,b=0;
    for(int i=n-1;i>=1&&cnt<2;i--)
    {
        if(s[i]==s[i+1])
        {
            if(cnt==0) a=s[i],cnt++,i--;
            else b=s[i],cnt++,i--;
        }
    }
    printf("%lld\n",a*b);
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int n,k;
  cin>>n>>k;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l[i];
  }

  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int ans=0;
  for(int i=0;i<k;i++){
    ans+=l[i];
  }
  cout << ans <<endl;

}


Measured memory_bytes: 256
import numpy as np
from numba import njit

#'''
N, K = map(int, input().split())
As = list(map(int, input().split()))
'''
N = 200000
K = 100000
As = [0] * N
#'''

@njit()
def update(A_array):
    before_csum = np.zeros(N+1, np.int32)
    for i, A in enumerate(A_array[:N]):
        before_csum[max(0, i-A)] += 1
        before_csum[min(N, i+A+1)] -= 1
    return np.cumsum(before_csum)
    
A_array = np.array(As + [0], dtype = np.int32)
for k in range(min(K, 50)):
    A_array = update(A_array)
    
print(*A_array.tolist()[:N])


Measured memory_bytes: 133840
#include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){
	int x=0;bool f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}

int write(int x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(48+x%10);
}

const int p = 1e9+7;

int ksm(int a,int b){
	int res=1;
	while(b){
		if(b&1)res=res*a%p;
		a=a*a%p;
		b>>=1;
	}
	return res;
} 

const int maxn = 1e7+5;

int n,k;
int fac[maxn],inv[maxn];

void init(){
	fac[0]=1;inv[0]=1;
	for(register int i=1;i<=n;++i) fac[i]=fac[i-1]*i%p;
	inv[n]=ksm(fac[n],p-2);
	for(register int i=n-1;i>=1;--i)
	  inv[i]=inv[i+1]%p*(i+1)%p;
}

inline int C(int a,int b){
	if(a<b)return 0;if(a==b)return 1;
	return fac[a]*inv[b]%p*inv[a-b]%p;
}

signed main(){
	n=read(),k=read();
	init();
	for(register int i=1;i<=k;++i){write(C(n-k+1,i)*C(k-1,i-1)%p);putchar('\n');}
	return 0;
}


Measured memory_bytes: 2304
import sys
X = int(input())
for i in range(1,int(X**(0.5)+1)):
    if X % i ==0:
        a=0
        b=-i
        while a**5<X**2:
            a+=1
            b+=1
            if a**5-b**5==X:
                print(a,b)
                sys.exit()

Measured memory_bytes: 9444
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
		}
      	int count = 1;
      	for(int i=0; i<a.length; i++){
			if(a[i]==count) count++;
		}
      	int ans = n+1-count;
      	if(ans == n) System.out.println("-1");
        else System.out.println(ans);
	}
}


Measured memory_bytes: 60408
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;



int main(){
    int N,a[3][3],b[12];
    int ok[3][3];
    rep(i,0,3){
        rep(j,0,3){
            ok[i][j]=0;
            cin>>a[i][j];
        }
    }
    cin>>N;
    rep(i,0,N)cin>>b[i];
    rep(i,0,N){
        rep(j,0,3){
            rep(k,0,3){
                if(b[i]==a[j][k])ok[j][k]=1;
            }
        }
    }
    if((ok[0][0]==1&&ok[0][1]==1&&ok[0][2])||(ok[1][0]==1&&ok[1][1]==1&&ok[1][2])||(ok[2][0]==1&&ok[2][1]==1&&ok[2][2])||(ok[0][0]==1&&ok[1][0]==1&&ok[2][0])||(ok[0][1]==1&&ok[1][1]==1&&ok[2][1])||(ok[0][2]==1&&ok[1][2]==1&&ok[2][2])||(ok[0][0]==1&&ok[1][1]==1&&ok[2][2])||(ok[0][2]==1&&ok[1][1]==1&&ok[2][0])){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}






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

int main() {
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if (S.at(0) == S.at(1) && S.at(1) != S.at(2) && S.at(2) == S.at(3)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repll(i, a, b) for(ll i = a; i < b; i++)
#define pb push_back
#define all(x) x.begin(),x.end()

int main() {
    int n;
    cin >> n;
    if(n%1000 == 0) {
    	cout << "0\n";
    	return 0;
    }
    int ans = 1000 - n%1000;
    cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3632
// Three-letter acronym

#include <iostream>

using namespace std;

char toUpper(char c){
	char dif = 'A' - 'a';
	return c + dif;
}

int main(){
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	cout << toUpper(s1[0]) << toUpper(s2[0]) << toUpper(s3[0]) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e5 + 10;
int n , k;
char s[N];
int main(){
	cin >> n >> k;
	scanf("%s",s);
	for (int i = 0;i < n;i++){
		printf("%c",i == k - 1 ?  s[i] - 'A' + 'a' : s[i]);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


//—————————————UnionFind木   UF uf(n);——————————————————————

struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void reset(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

//—————————————————————————————————————————————————


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

  int n,m;
  cin>>n>>m;

  UF uf(n);

  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }

  ll ans=0;
  rep(i,n){
    chmax(ans,uf.size(i));
  }

  cout << ans << endl;

}

Measured memory_bytes: 6360
/*2019/10/02 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
typedef struct{
    int a;
    int b;
}pair_t;
//int asc_t(const void *a,const void *b){if((pair_t*)a->d < (pair_t*)b->d)return -1;else if((pair_t*)a->d == (pair_t*)b->d)return 0;else return 1;}
int desc_t(const void *a,const void *b){if(((pair_t*)a)->b < ((pair_t*)b)->b)return 1;else if(((pair_t*)a)->b == ((pair_t*)b)->b)return 0;else return -1;}


int main(){
    int n,m;
    pair_t pair[200000]; 

    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&pair[i].a,&pair[i].b);
    }

    int rlt[300000]={};
    
    for(int i=0;i<m;i++){
        if(pair[i].b==n){
            rlt[pair[i].a]=n;
        }
    }
    for(int i=0;i<m;i++){
        if(pair[i].a==1){
            if(rlt[pair[i].b]==n){
                printf("POSSIBLE\n");
                return 0;
            }
        }
    }
    printf("IMPOSSIBLE\n");
    return 0;
}

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

int main(void){
  
  vector<vector<int>> a(3, vector<int>(3));
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++ ) {
      cin >> a.at(i).at(j);
    }
  }
  
  vector<int> x(3);
  vector<int> y(3);
  
  int a1 = 0;
  
  for (int i = 0; i < 3; i++) {
    y.at(i) = a.at(0).at(i);
  }
  
  for (int i = 1; i < 3; i++) {
    x.at(i) = a.at(i).at(0) - y.at(0);
  }
  
  
  bool flag = true;
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (x.at(i) + y.at(j) != a.at(i).at(j)) {
        flag = false;
      }
    }
  }
  
  if (flag){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())

#mp[h][w]
mp = [[0]*w for _ in range(h)]
for i in range(h):
    tmp = input()
    for j in range(w):
        mp[i][j] = tmp[j]

#for i in range(h):
#    print(mp[i])


#can reach with 0
q = deque()
dx1 = (-1, 0, 1, 0)
dy1 = (0,-1,0,1)
dx2 = (-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2)
dy2 = (-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2)
q.append((ch-1,cw-1))

q2 = deque()

mpc = [[0]*w for _ in range(h)]

mpc[ch-1][cw-1] = 1
while q:
    x, y = q.popleft()
    for i in range(4): 
        nx = x+dx1[i]
        ny = y+dy1[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] != mpc[x][y]:           
            mpc[nx][ny] = mpc[x][y]
            q.appendleft((nx,ny))

    for i in range(len(dx2)):
        nx = x+dx2[i]
        ny = y+dy2[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] == 0:       
            mpc[nx][ny] = mpc[x][y] + 1
            q.append((nx,ny))
    
#for i in range(h):
#    print(mpc[i])

print(mpc[dh-1][dw-1]-1)



Measured memory_bytes: 161620
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	k := scanInt(sc)

	trees := make([]int, n)
	for i := 0; i < n; i++ {
		trees[i] = scanInt(sc)
	}

	sort.Ints(trees)

	min := math.MaxInt32
	for i := 0; i <= n-k; i++ {
		diff := trees[i+k-1] - trees[i]
		if diff < min {
			min = diff
		}
	}

	fmt.Println(min)
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	char x;
	cin >> x;
	if(x=='a'||x=='i'||x=='u'||x=='e'||x=='o'){
		cout << "vowel" << endl;
	}else{
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc140/tasks/abc140_d

# 性質ちゃんと考える
# 連長圧縮したあとならば、r-lが奇数である組み合わせをひっくり返すのに価値がある
# 反転しても中の幸福度は変化しない。
# 幸福度が改善するのはLR or RLでなくなった部分だけ

# LLLLLL (幸福度5(max))
# LRLRRL (幸福度1 (4人死んでるので)) #一回の操作が最善ならば必ず2人改善する(l==rの場合は1人改善)
# LLRLLL (幸福度3 (1から2人復活したので))


# もしラストをひっくり返すことで幸福度が上がるなら？
# ラストに0文字のLをfillする必要がある？
# LRRLRLRRLRLLR (max 12) (N-1) (今は3)
# 3回操作によって＋6なので9となる

# 10 1
# LLLLLRRRRR (max9) (いま8)
# そうかL→RとR→Lの個数をカウントすればいいんだ

N, K = list(map(int, input().split()))
S = input()

score = -1
LtoR = 0
RtoL = 0
pre = S[0]
for s in S:
    if pre == s:
        score += 1
    elif pre == 'L':
        LtoR += 1
    elif pre == 'R':
        RtoL += 1
    else:
        raise ValueError('something wrong')
    pre = s

# print(score, LtoR, RtoL)
if K <= min(LtoR, RtoL):
    print(score + 2 * K)
else:
    print(score + LtoR + RtoL)


Measured memory_bytes: 3316
/*

結果:
*/
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }

long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }


int main() {

	int  n,i;
	int ans = 0;

	n = in(); i = in();

	ans = n +1-i;

	print(ans);



#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	

	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		long  a,b,c;
		a=cin.nextInt();
		b=cin.nextInt();
		c=cin.nextInt();
		if((c-a-b)<0)
		{
			System.out.println("No");
		}
		else {
			if((c-a-b)*(c-a-b)>4*a*b)
			{
				System.out.println("Yes");
			}
			else
			{
				System.out.println("No");
			}
		}
		cin.close();
	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>  
using namespace std;  
typedef long long ll;  
const int N=1<<15;  
int n,m,c[15][15];  
int p[N],dp[N][15];  
void init()  
{  
    memset(p,0,sizeof(p));  
    for(int i=0;i<(1<<n);i++)  
        for(int j=0;j<n;j++)  
            dp[i][j]=-1;  
    for(int i=0;i<(1<<n);i++)  
    {  
        for(int j=0;j<n;j++)  
        {  
            if(((i>>j)&1)==0)  
                continue;  
            for(int k=j+1;k<n;k++)  
            {  
                if(((i>>k)&1)==0)  
                    continue;  
                p[i]+=c[j][k];  
            }  
        }  
    }  
}  
int main()  
{  
    while(cin>>n>>m)  
    {  
        int sum=0;   
        int u,v,w;  
        memset(c,0,sizeof(c));  
        while(m--)  
        {  
            scanf("%d%d%d",&u,&v,&w);  
            u--,v--;  
            c[u][v]=c[v][u]=w;  
            sum+=w;  
        }  
        init();  
        dp[1][0]=0;  
        for(int i=0;i<(1<<n);i++)  
        {  
            for(int j=0;j<n;j++)  
            {  
                if(dp[i][j]==-1)  
                    continue;  
                int x=(((1<<n)-1)^i)|(1<<j);    //y is some subset of x  
                for(int y=x;y>=0;y--)  
                    y&=x,dp[i|y][j]=max(dp[i|y][j],dp[i][j]+p[y]);    
                      
                for(int k=0;k<n;k++)  
                {  
                    if((i>>k)&1)  
                        continue;  
                    if(c[j][k]==0)  
                        continue;  
                    dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+c[j][k]);  
                }  
            }  
        }  
        int ans=1e9;  
        for(int i=0;i<(1<<n);i++)  
            ans=min(ans,sum-dp[i][n-1]);  
        cout<<ans<<endl;  
    }  
    return 0;  
}  

Measured memory_bytes: 2432
A,B,C,D = list(input())

for op1 in ['+','-']:
    for op2 in ['+','-']:
        for op3 in ['+','-']:
            formula = A+op1+B+op2+C+op3+D
            res = eval(formula)
            if res == 7:
                print(formula+'=7')
                exit()

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    string S;
    cin >> N;
    cin >> S;
    
    for(int i = 0; i < S.size(); i++){
        if(S[i] + N > 90)
            cout << (char)(S[i] + N -26) << ( i != S.size() ? "" : "\n" );
        else
            cout << (char)(S[i] + N) << ( i != S.size() ? "" : "\n" );
    }
    
}

Measured memory_bytes: 256
N = int(input())
S = input()

R = []
G = []
B = []
for i in range(N):
  if S[i] == "R":
    R.append(i+1)
  elif S[i] == "G":
    G.append(i+1)
  elif S[i] == "B":
    B.append(i+1)

ok = len(R) * len(G) * len(B)
for i in range(1,N):
  for j in range(N//2+1):
    if i - j < 0 or i + j >= N:
      break
    else:
      if S[i-j] != S[i] and S[i] != S[i+j] and S[i-j] != S[i+j]:
        ok -= 1

print(ok)

Measured memory_bytes: 9256
#include<iostream>
using namespace std;
int main(){
int n,m,b,c;
cin>>n>>m>>b;
for(int i=0;i<100;i++){
if((b+i*60)%(n+m)<=n){
c=b+i*60;
goto a;
}
}
c=-1;
a:
cout<<c<<endl;
return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>

using namespace std;

#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);

#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)

#define DEB(X) if(mode==1)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(mode==1)cout<<X<<" ";
#define ARDEB(i,X) if(mode==1)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define FORDEB(n,X) if(mode==1)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(mode==1)cout<<endl;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
struct P2{int x,y;};
//struct edge{int from,cost,to;};

const int MOD7=1000000007;
const int INF=100000000;
int mode=0;

int main(){
	int n,last=1;
	cin>>n;
	for(int i=1;;i++){
		if(i*i>n){
			cout<<last<<endl;
			return 0;
		}
		last=i*i;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <functional>
#include <cstring>
#include <queue>
#include <cmath>
#include <deque>
#include <list>
#include <iomanip>
#include <fstream>
#include <string>
#include <iterator>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, N) FOR(i, 0, N)
#define SZ(x) ((int)(x).size())

const int MAXN = 107, INF = 1000000007;

int main()
{
	string s;
	int n, cnt[30];
	ll ans;
	cin >> s;
	n = SZ(s);
	ans = 1 + n*(n - 1LL)/2;
	memset(cnt, 0, 4*30);
	REP(i, n) ++cnt[s[i] - 'a'];
	REP(i, 30)
		ans -= cnt[i]*(cnt[i] - 1LL) / 2;
	cout << ans;
	//cout << endl; system("pause");//please
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

using real = double;
real EPS = 1e-10;
struct Point3 {
    real x, y, z;
    Point3& operator+=(const Point3 a) { x += a.x; y += a.y; z += a.z;  return *this; }
    Point3& operator-=(const Point3 a) { x -= a.x; y -= a.y; z -= a.z; return *this; }
    Point3 operator+(const Point3 a) const {return Point3(*this) += a; }
    Point3 operator-(const Point3 a) const {return Point3(*this) -= a; }
    explicit Point3(real a = 0, real b = 0, real c = 0) : x(a), y(b), z(c) {};
};


inline real dot(Point3 a, Point3 b){ return a.x*b.x + a.y*b.y + a.z*b.z; }
inline Point3 cross(Point3 a, Point3 b){
    return Point3(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x);
}
inline real abs(Point3 a){ return sqrt(dot(a, a)); }

struct Segment {
    Point3 a, b;
    Segment(Point3 x, Point3 y) : a(x), b(y) {};
};


double distance(Segment l, Point3 c){
    if(dot(l.b-l.a, c-l.a) <= 0) return abs(c-l.a);
    if(dot(l.a-l.b, c-l.b) <= 0) return abs(c-l.b);
    return abs(cross(l.b-l.a, c-l.a)) / abs(l.a-l.b);
}

struct Sphere{
    Point3 c;
    double r;
    Sphere(){};
    Sphere(Point3 c, double r): c(c), r(r){};
};

bool intersect(Segment s,Sphere c){
    double d=distance(s,c.c);
    return d < c.r+EPS;
}

int main() {
    int n, q;
    cin >> n >> q;
    vector<Sphere> v(n);
    vector<uint64_t> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i].c.x >> v[i].c.y >> v[i].c.z >> v[i].r >> x[i];
    }
    for (int i = 0; i < q; ++i) {
        double a, b, c, d, e, f;
        cin >> a >> b >> c >> d >> e >> f;
        Segment S(Point3(a, b, c), Point3(d, e, f));
        uint64_t ans = 0;
        for (int j = 0; j < n; ++j) {
            if(intersect(S, v[j])) ans += x[j];
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <cstdio>

using namespace std;

struct Square{
	int x;
	int y;
};

int main(void) {
	for (;;) {
		int max_x = 0;
		int min_x = 0;
		int max_y = 0;
		int min_y = 0;

		Square sqrs[200];
		sqrs[0].x = 0;
		sqrs[0].y = 0;

		int n;
		cin >> n;
		if (n == 0)
			break;

		for (int i = 1; i < n; i++) {
			int num, d;
			cin >> num >> d;

			int x, y;
			x = sqrs[num].x;
			y = sqrs[num].y;

			switch (d) {
			case 0:
				x--;
				break;
			case 1:
				y--;
				break;
			case 2:
				x++;
				break;
			case 3:
				y++;
				break;
			}
			sqrs[i].x = x;
			sqrs[i].y = y;

			if (x > max_x) {
				max_x = x;
			} else if (x < min_x) {
				min_x = x;
			}
			if (y > max_y) {
				max_y = y;
			} else if (y < min_y) {
				min_y = y;
			}
		}
		printf("%d %d\n", max_x - min_x + 1, max_y - min_y + 1);
	}
	return 0;
}

Measured memory_bytes: 1144
#include <stdio.h>

int main()
{
  int n;
  const int MAX_N = 999999;
  int a[MAX_N + 1];
  int i, j;
  int cnt;

  for (i = 0; i <= MAX_N; ++i){
    a[i] = 1;
  }

  a[0] = a[1] = 0;

  for (i = 0; i * i <= MAX_N; ++i){
    if (a[i] == 1){
      for (j = 2 * i; j <= MAX_N; j += i){
        a[j] = 0;
      }
    }
  }

  while (scanf("%d", &n) != EOF){
    cnt = 0;
    for (i = 0; i <= n; i++){
      if (a[i] == 1){
        cnt++;
      }
    }

    printf("%d\n", cnt);
  }

  return (0);
}

Measured memory_bytes: 4500
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int a[2][105],b[105];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<2;i++)
    for(int j=1;j<=n;j++)
    scanf("%d",&a[i][j]);
    for(int i=2;i<=n;i++)
    a[0][i]+=a[0][i-1];
    for(int i=n-1;i>0;i--)
    a[1][i]+=a[1][i+1];
    for(int i=1;i<=n;i++)
    b[i]=a[0][i]+a[1][i];
    int res=-1;
    for(int i=1;i<=n;i++)
    res=max(res,b[i]);
    printf("%d\n",res);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
bool isSquare(int);

int main()
{
	int N, D;
	cin >> N;
	cin >> D;
	vector<vector<int>> X;
	for (int i = 0; i < N; i++)
	{
		vector<int> line;
		for (int j = 0; j < D; j++)
		{
			int tmp;
			cin >> tmp;
			line.push_back(tmp);
		}
		X.push_back(line);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i+1; j < N; j++)
		{
			int d2 = 0;
			for (int k = 0; k < D; k++)
			{
				d2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			if (isSquare(d2))
			{
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

bool isSquare(int a)
{
	bool ans = false;
	for (int i = 0; i*i < 400000; i++)
	{
		if (a==i*i)
		{
			ans = true;
			break;
		}
		else if (i*i>a)
		{
			break;
		}
	}
	return ans;
}

Measured memory_bytes: 256